Logical operators are used to check whether an expression is true
or false
. They are used in decision making.
Operator | Example | Meaning |
---|---|---|
&& (Logical AND) | expression1 && expression2 | true only if both expression1 and expression2 are true |
| (Logical OR) | expression1 | expression2 | true if either expression1 or expression2 is true |
! (Logical NOT) | **!**expression | true if expression is false and vice versa |