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).
e1
e2
Result
0
0
0
0
1
0
1
0
0
1
1
1
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).
e1
e2
Result
0
0
0
0
1
1
1
0
1
1
1
1
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).