Quantcast
Channel: Hacker News 50
Viewing all articles
Browse latest Browse all 9433

Alexander Brevig : The //* /*/ //*/ comment toggle trick

$
0
0

Comments:"Alexander Brevig : The //* /*/ //*/ comment toggle trick"

URL:https://coderwall.com/p/zbc2zw


DISCLAIMER: This is a trick. Do not adopt this trick in production code. Use it wisely while you're doing proof of concept and the like.

So, I guess I'm not the only one that need some way of easily toggling code in and out of the code.

This trick below can be used to toggle between two sets of code, with one symbol in the code with no additional short-keys to learn, and no tool dependencies!

//* /*
someCode(); someCode();
/*/ /*/
someOtherCode(); someOtherCode();
//*/ //*/

Here is a version for simply commenting code in and out:

Activated:

//*
someCode();
//*/

Deactivated / commented out:

/*
someCode();
//*/

Viewing all articles
Browse latest Browse all 9433

Trending Articles