1.5.4 Boolean

The boolean operators return either 1 (true) or 0 (false).

expression1 && expression2
Returns the logical AND operation of expression1 and expression2. The result is 1 (true) if both expressions are true, otherwise the result is 0 (false).

e1e2Result
000
010
100
111


expression1 || expression2
Returns the logical OR operation of expression1 and expression2. The result is 0 (false) if bother expressions are false, otherwise the result is 1 (true).

e1e2Result
000
011
101
111


expression1 < expression2
Returns 1 (true) if expression1 is less than expression2, otherwise the result is 0 (false).

expression1 > expression2
Returns 1 (true) if expression1 is greater than expression2, otherwise the result is 0 (false).

expression1 <= expression2
Returns 1 (true) if expression1 is less than or equal to expression2, otherwise the result is 0 (false).

expression1 >= expression2
Returns 1 (true) if expression1 is greater than or equal to expression2, otherwise the result is 0 (false).

expression1 == expression2
Returns 1 (true) if expression1 is equal to expression2, otherwise the result is 0 (false).

expression1 != expression2
Returns 1 (true) if expression1 is not equal to expression2, otherwise the result is 0 (false).