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

19 thoughts on “Single character commenting

  1. yes. and it works. i use it for several years now – so i can use the great 6581 chip :)

    before i found this dos-2-c64 thingi i did it with my amiga – and from my amiga to my pc-harddrive so it was a three-way option.

  2. Don’t give up on those old floppies as goners just yet. I decided to back up all my 5.25″ disks to CD-RW and I know some of them had not been touched in 20 years and they still all read fine.

Comments are closed.

Tagged