Click here to Skip to main content
Click here to Skip to main content

Super-Easy Code Block Toggling

By , 30 Aug 2011
 
This nice trick extends into:
 
//*/
block 1
/*/
block 2; // commented out
/*/
block 3;
/*/
block 4; // commented out
//*/
 
and removing the first slash gives inverted alternation:
 
/*/
block 1; // commented out
/*/
block 2;
/*/
block 3; // commented out
/*/
block 4;
//*/
 
This enables you to alternate between odd and even sequential blocks :). It will extend to infinite count of blocks! Even more curious but sometimes usefull nonetheless, alternation can be switched wherever you like:
 
/*/
block 1; // commented out
/*/
block 2;
/*/
block 3; // commented out
/*/
block 4;
/*/
block 5; // commented out
/*/
block 6;
//*/
 
can be switched into:
 
/*/
block 1; // commented out
/*/
block 2;
/*/
block 3; // commented out
/*/
block 4;
//*/
block 5;
/*/
block 6; // commented out
//*/
:D ILa

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

ILa @ work
Engineer
Netherlands Netherlands
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralReason for my vote of 5 Superb my 5memberAshish Tyagi 406 Sep '11 - 19:12 
Reason for my vote of 5
Superb my 5

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 30 Aug 2011
Article Copyright 2011 by ILa @ work
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid