Short-Circuiting Logical Expressions

Following the convention in most other programming languages, logical expressions in MAXScript are short-circuiting or non-strict. This means only enough of the sub-expression is evaluated to determine the overall result:

This saves execution time and enables useful shorthand notation.

FOR EXAMPLE,

if you want to calculate "sin a" if the value of variable a isn’t undefined , you can use the following

if a != undefined and sin a > 0 then...

In a strict language, the "sin a" evaluation of an undefined operand results in an error, and you would need to break up the expression into two if statements:

if a != undefined then
if sin a > 0 then ...