Change a variable in a useless state

Is this code correct if foo == 13 false?

 if (foo == 13 && ++bar > 42) { ... } 
+6
source share
1 answer

Yes. If the first condition is false, the second will never be evaluated.

See Avoid the side effects of the second expression .

+11
source

All Articles