MAXScript Language Reference > Names, Literal Constants, and Expressions > Simple Expressions > Logical Expressions >

# 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:

- If the first operand is false in an and expression, the result must be false , therefore, the second operand is not evaluated.

- If the first operand is true in an or expression, the result must be true , therefore, the second operand is not evaluated.

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 ...