About logical operators

You use logical operators to compare Boolean values (true and false) and then return a Boolean value based on the comparison. For example, if you have two operands that evaluate to true, the logical AND (&&) operator returns true. Or if one or both of the operands evaluate to true, the logical OR (||) operator returns true.

The logical operators take two operands and return a Boolean result. The logical operators differ in precedence and are listed in the table in order of decreasing precedence:

Operator

Operation performed

&&

Logical AND

||

Logical OR

For information on using logical operators, see Using logical operators.