I learned this trick from Chuck Jazdzewski so it's a goodie but oldie and real simple.
If you are working on two chunks of code that you need to go between you can use a comment like this:
{Exit(0); //}Exit(1);
Remove the first curly brace and instantly and easily your code changes:
Exit(0); //}Exit(1);
There is also a version of this for C++:
//*
return 0;
/*/
return 1;
//*/
Remove the first slash and instantly and easily your code changes:
/*
return 0;
/*/
return 1;
//*/
5 comments:
better yet-- use (* *) to enclose large sections of code.
recent codegear musings have me worried that support for (* *) may disappear soon.
^/ is something i use more commonly now.
Great trick!
X-Ray,
But with the the comment trick I posted about it only takes on character change. Using (* *) is two locations and 4 characters.
I don't think you have to worry about (* *) going away as a comment style.
I use the CTRL+/ a lot these days for commenting. It's very fast for adding and removing comments.
Alister,
CTRL + / is a very handy way to comment out code. However, my tip allows you to switch between two different pieces of code really fast.
Post a Comment