Single character commenting

Technology

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

Discuss this article with the rest of the community on our Discord server!
Tagged

ADVERTISEMENT

Ready to dive into the realm of hands-on innovation? This collection serves as your passport to an exhilarating journey of cutting-edge tinkering and technological marvels, encompassing 15 indispensable books tailored for budding creators.

FEEDBACK