Toggle Comment Trick
This is probably common knowledge for many of you, and if you have a decent editor it’s moot. But I figured I’d share.
If you are developing in a programming language that allows for both single line and multiline comments and you’d like to more easily comment/uncomment multiline comments, this trick may come in handy.
Below is an as3 example:
///*
var userName:String = "testname";
var userPass:String = "testpass";
//*/
/*
var userName:String = userNameTF.text;
var userPass:String = userPassTF.text;
//*/
This way you don’t have to constantly insert and remove your multiline comment tags. By adding/removing a single line comment delimiter (
//) in front of the initial multiline comment delimiter(
/*) you can comment/uncomment your block of code.
One can argue that it’s takes just as many keystrokes to remove the initial multiline delimiter (
/*) as it does adding a single line delimiter (
//). However, having your initial multiline delimiter always present, makes your comment block boundaries consistently visible.
Permalink
Sharedtut 10:29 AM on February 3, 2010
Great job, thank you for sharing.