Logical Operators
More complicated logical expressions can be built from
simpler ones by using the logical
operators: and, or, and
not . The ! operator is unary, while && and II | are binary.
Symbol
|
Meaning
|
!
|
logical negation
|
&&
|
logical and
|
II
|
logical or
|
The logical operators produce either 0 or 1 as their result.
Often, the operands will have values of 0 or 1, but this isn't a requirement;
the logical operators treat any nonzero operand as a true value and any zero
operand as a false value.
No comments:
Post a Comment