I saw somewhere else said,
x && foo();
is equal to
if(x){ foo(); }
I tested it and they really di
This is known as short-circuit evaluation.
In this case, if x is False, then foo() doesn't need to be evaluated (the result of && will always be False); if x is True, it does need to be evaluated (even if the result is thrown away).
x
foo()
&&