GENERATE/PREV.gifGENERATE/NEXT.gif

Precedence and Associativity

As in mathematics, a sequence of operands and operators is evaluated according to a set of precedence and association rules. The following table shows some example expressions and their order of evaluation:

Expression      Order of evaluation

a + b * c      a + (b * c)

a + b - c      (a + b) - c

a ^ b ^ c      a ^ (b ^ c)      -- exponentiation, raise to the power

The evaluation order in the above table follows standard precedence rules, where * and / operations are evaluated before + and - operations, and where + and - operations associate to the left and exponentiation operations associate to the right.

These precedence rules define the ordering of evaluation in all expressions in MAXScript, unless parenthesizing is used to force a different order.

The following list shows the precedence order for math expressions starting with the highest precedence:

<operand>

<function_call>

as

^      -- right associative

* and /      -- left associative

+ and -      -- left associative

For more details, see the Precedence topic.