& is unconditional logical AND; && is conditional logical AND; | is unconditional logical OR; || is conditional logical OR;
The diffrence between conditional and unconditional logical operator is the single ampersand always evaluates both arguments whereas the double ampersand will only evaluate the second argument if the first argument is true.
Check the below examples.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | |
Best Regards.