Click here to Skip to main content
Click here to Skip to main content
Alternative Tip
Go to top

Super-Easy Code Block Toggling

, 30 Aug 2011
Rate this:
Please Sign up or sign in to vote.
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...
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 Smile | :) . 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
//*/
Big Grin | :-D ILa

License

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

Share

About the Author

ILa @ work
Engineer
Netherlands Netherlands
No Biography provided

Comments and Discussions

 
GeneralReason for my vote of 5 Superb my 5 PinmemberAshish Tyagi 406-Sep-11 19:12 

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

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140926.1 | Last Updated 30 Aug 2011
Article Copyright 2011 by ILa @ work
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid