Logical Expressions
Logical expressions combine two or more expressions/conditions and evaluate to a
bool
value (Either true
or false
) based on the specific
operator used.
The NOT operator (!
) is also a logical operator, even though unlike the other operators
it can be only used on a single expression, and can be used to invert the result of a logical
expression.
Syntax
For the logical AND
and OR
:
For the logical NOT
:
Examples
Logical AND
Logical OR
Logical NOT
Chained Logical Expressions
Logical Expressions may be also chained together as long as you want. For example:
Logical Expressions & Relational Expressions
You can also combine relational expressions with logical expressions, like this for example: