What does "if (1)" do?

perl

Solution

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.

Problem

What does the syntax ``` if (1) {} ``` do? I can't find documentation for this syntax and 1 is not being treated as a boolean. Am I right?.

Original source

Related problems