Logical Operators

Definition

Logical operators perform and, or, and not operations. They work by evaluating the first operand and then, if necessary the second. The second operand is evaluated only if its value is needed to determine the result.

Logical and && Returns TRUE if both operands evaluate to TRUE; returns FALSE if either operand is FALSE.
Logical or || Returns TRUE if either operand evaluates to TRUE; returns FALSE if both operands are FALSE.
Logical not ! Takes only one operand. If the operand evaluates to TRUE, ! makes the resulting value FALSE. If the operand evaluates to FALSE, ! makes the resulting value TRUE.

Operand Type

Operands to logical operators must all have type BOOLEAN.

Result Type

The logical operators return one of the BOOLEAN values TRUE or FALSE.