Information Technology Reference
In-Depth Information
Conditional Logical Operators
The logical operators are used for comparing or negating the logical values of their operands
and returning the resulting logical value. The operators are listed in Table 8-11.
The logical AND and logical OR operators are binary and left-associative. The logical NOT
is unary.
Table 8-11.
The Conditional Logical Operators
Operator
Name
Description
&&
true
if both operands are true;
false
otherwise
Logical AND
||
Logical OR
true
if at least one operand is true;
false
otherwise
!
tru
e if the operand is false;
false
otherwise
Logical NOT
The syntax for these operators is the following, where
expr1
and
expr2
evaluate to
Boolean values.
Expr1
&&
Expr2
Expr1
||
Expr2
!
Expr