What does “if (1)” do?

Technically, the if (1) does nothing interesting, since it’s an always-executed if-statement.

One common use of an if (1) though is to wrap code you’d like to be able to quickly disable, say for debugging purposes. You can quickly change an if (1) to if (0) to disable the code.

Leave a Comment