The first statement compares the variable ‘a’ to ‘1’, and if the variable ‘a’ is equal to ‘1’, then you will execute the block of code enclosed in brackets. Likewise, the first statement also compares the variable ‘b’ to ‘1’ and if equal will execute a block of code.
The second expression evaluates two conditions, ‘a’ being equal to 1, and ‘b’ being equal to ‘2’. If either expression is true, then the block of code enclosed in brackets will execute. The double pipe symbol ‘||’ is synonymous with ‘or’.
0
solved Difference between `if` statements [closed]