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?.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With