Sunday, April 19, 2009

Quickly Switching Between Chunks of Code

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;
//*/

No comments: