![]() |
![]() |
![]() |
![]() |
![]() |
|
The evaluation of && and || expressions is complicated
because certain subexpressions may not be evaluated at all.
In
&& expressions, the left-side operand is evaluated first: If the
value of the left-side operand is false, then the right-side operand is
ignored completely, and the value of the && expression is false.
Of course, if both operands evaluate to true, the value of the
&& expression is true.
In
|| expressions, the left-side operand also is evaluated first: If
the left-side operand evaluates to true, nothing else is done, and
the value of the || expression is true; if both operands
evaluate to false, the value of the || expression is
false.