# Precedence and Association Rules

As in mathematics, a sequence of operands and operators is evaluated according to a set of precedence and association rules. The following table shows sample 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 previous table follows standard precedence rules, where * and / operations are evaluated before + and - operations, and where + and - operations associate to the left (that is, operands on the left are evaluated before operands on the right) and exponentiation operations associate to the right (that is, operands on the right are evaluated before operands on the left).

These precedence rules define the ordering of evaluation in all expressions in MAXScript, unless parenthesizing is used to force a different order. Expressions in parenthesis are evaluated before the surrounding operands are applied.

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