| Applying science to business management |
  
Conditional Evaluation
Unlike most other operators, Logical
And and Logical Or do
not necessarily evaluate both operands. For example, the
expression false&&x will
evaluate to false regardless of the value of x.
Similarly, true||x is always true.
In both of these cases, the value of the second operand is
unimportant, so DScript will not evaluate it. It is important to
be aware of this behavior, especially if evaluating the second
operand could cause some side effect.
Note that only the second operand is conditionally evaluated.
The expression x&&false
is always false, regardless of the value of x.
However, in this case, x will still be evaluated. DScript
includes a capability called Logical Look-Ahead that
extends the conditional evaluation of operands so that x
will not be evaluated in this example as well.
|