Find all your DIY electronics in the MakerShed. 3D Printing, Kits, Arduino, Raspberry Pi, Books & more!

It’s a pretty common practice to comment and uncomment big chunks of code during the development and testing of software. Here’s an odd little hack from the ajaxian blog that can make this a little easier for blocks that you’re constantly flipping on and off during development.

For C style comments, the following will be commented out:

/*
if ( foo == bar )
{
  dosomething();
  return();
}
// */

And the addition of a single ‘/’ will uncomment the block:

//*
if ( foo == bar )
{
  dosomething();
  return();
}
// */

In languages that don’t have the single line comment, such as CSS, you can do the same thing with only the block level comments.
Commented:

/*/
min-height:100px;
/**/

Uncommented:

/**/
min-height:100px;
/**/

You are probably talking to your screen right now, saying, “hey Jason, that commenting trick is marginally useful at best.” I can only respond by reminding you that every keystroke is a beautiful and unique snowflake that must be cherished and never wasted.

A neat commenting trick – Link


Related
blog comments powered by Disqus

Related Supplies at Maker Shed

Follow

Get every new post delivered to your Inbox.

Join 26,184 other followers