Conditional Evaluation

Unlike most other operators, Logical And and Logical Or do not necessarily evaluate both operands. For example, the expression false&&x evaluates 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 does not evaluate it. It is important to be aware of this behavior, especially if evaluating the second operand could cause some side effect.

See Logical And.

See Logical Or.

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 is still evaluated. DScript includes a capability called Logical Look-Ahead that extends the conditional evaluation of operands so that x is not evaluated in this example as well.

See Boolean Operators.