4.13.7 Boolean Expressions

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 y

If xfalse, the result is false and y is not evaluated.

x or y

If xtrue, the result is true and y is not evaluated.