13,092,862 members (98,539 online)
Alternative Tip/Trick
alternative version

Stats

3.6K views
Posted 30 Aug 2011

Super-Easy Code Block Toggling

, 30 Aug 2011
 Rate this:
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:

```<pre lang="c#">//*/<br />
block 1<br />
/*/<br />
block 2; // commented out<br />
/*/<br />
block 3;<br />
/*/<br />
block 4; // commented out<br />
//*/</pre>```

and removing the first slash gives inverted alternation:

```<pre lang="c#">/*/<br />
block 1; // commented out<br />
/*/<br />
block 2;<br />
/*/<br />
block 3; // commented out<br />
/*/<br />
block 4;<br />
//*/</pre>```

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:

```<pre lang="c#">/*/<br />
block 1; // commented out<br />
/*/<br />
block 2;<br />
/*/<br />
block 3; // commented out<br />
/*/<br />
block 4;<br />
/*/<br />
block 5; // commented out<br />
/*/<br />
block 6;<br />
//*/</pre>```

can be switched into:

```<pre lang="c#">/*/<br />
block 1; // commented out<br />
/*/<br />
block 2;<br />
/*/<br />
block 3; // commented out<br />
/*/<br />
block 4;<br />
//*/<br />
block 5;<br />
/*/<br />
block 6; // commented out<br />
//*/</pre>```

:D ILa

Share

 Engineer Netherlands
This member doesn't quite have enough reputation to be able to display their biography and homepage.

You may also be interested in...

 Pro

 View All Threads First Prev Next
 Reason for my vote of 5 Superb my 5 Ashish Tyagi 406-Sep-11 19:12 Ashish Tyagi 40 6-Sep-11 19:12
 Last Visit: 31-Dec-99 18:00     Last Update: 21-Aug-17 8:38 Refresh 1

General    News    Suggestion    Question    Bug    Answer    Joke    Praise    Rant    Admin

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