Coder of Salvation™   — programming / opensource / console / minimal

Clever Code toggling

This trick was shown to me once by Johan Adriaans:

Problem

Requirements

You need to be in a language which supports C-syntax comments. Languages like C, C++, Javascript, PHP, Actionscript etc.

How

  /**/
  
    // this will get executed
  
  /*/
  
    // this will get ignored
  
  /**/

OR:

  /*/
  
    // this will get ignored
  
  /*/
  
    // this will get executed
  
  /**/

Demo





comments powered by Disqus


All rights reserved by Leon van Kammen under this license