Quantcast
Channel: Cryptexo's Blog » Utilities
Viewing all articles
Browse latest Browse all 6

A simple and useful trick with multi-line comments.

$
0
0

 

1. Here is a simple example of multi-line comment we follow in most of the languages,

/*if( some conditional statements ){
 ...
 a lot of brilliant code goes here...
 ...
}*/

2. Many times when we need to un-comment the code block, it becomes difficult to find closing part of multi-line comment (*/) or vice a vesra.

3. Lets change above code block as following,

/*
if( some conditional statements ){
 ...
 a lot of brilliant code goes here...
 ...
}
//*/

Above cod block is now commented.

4. When you need to uncomment the block, make simple change at line 1, as following

///*
if( some conditional statements ){
 ....
 a lot of brilliant code goes here...
 ...
}
//*/

Now above code block is un-commented (will execute).

5. Using this trick one won’t have to look for (or remember) closing fragments every-time to comment or un-comment the code.

6.This may not be very useful when working with your cool editor, but will be useful while working with simple editors and while debugging on servers :p .

It work fine in JavaScript.
Let me know if it does not work in your favourite language. I will mention it here…



Viewing all articles
Browse latest Browse all 6

Latest Images

Trending Articles





Latest Images