Next: Operator Precedence, Previous: Special Comparisons, Up: Expressions [Contents][Index]
A boolean expression is a combination of relational or
matching expressions using the boolean operators and, or
and not, and, eventually, parentheses to control nesting:
| Expression | Result |
|---|---|
x and y | True only if both x and y are true. |
x or y | True if any of x or y is true. |
not x | True if x is false. |
table 4.1: Boolean Operators
Binary boolean expressions are computed using shortcut evaluation:
x and yIf x ⇒ , the result is falsefalse
and y is not evaluated.
x or yIf x ⇒ , the result is truetrue and
y is not evaluated.