Grouping operations

 

Parentheses, which are used for grouping operations, are at the top of the operator precedence hierarchy. As shown in the following examples, parentheses are useful for manually specifying the order of operator evaluation.

 

Examples

int $mao = (3 + 5) * 2;

float $fir = (1 + 2) * 5 * ($mao < 20);

$mao /= 2 + ((($fir -= 10) == 5) < 0.5);

 

You can use parentheses in MAXScript the same way as in MEL to define the order of evaluation. Since BooleanClass values cannot be converted implicitly to integers in MAXScript, the second and third examples cannot be converted directly without using IF THEN ELSE statements.

mao = (3 + 5) * 2

fir = (1 + 2) * 5 * (if mao < 20 then 1 else 0)

mao /= 2 + ( if (if ((fir -= 10) == 5) then 1 else 0) < 0.5 then 1 else 0 )