Confused about if condition, how does it executes following statements.
if(1 && (1 || 0) != 0) or if(1 || (1 && 0) != 0)
In above if statement what is the sequence of executing/validating the statements.
(left to right or right to left) if left to right, then if first argument/expression is true does it evaluates 2nd expression/argument? is it true for both the logical AND and OR operators.
Thanks.
Logical
&&short circuits if the first operand evaluates tofalse(becausefalse && xisfalsefor all x)Logical
||short circuits if the first operand evaluates totrue(becausetrue || xistruefor all x)They both evaluate left-to-right.