Math Assignment

MAXScript provides the C language shorthand form of assignment that can be used to modify a value in place, as shown in the following long-form examples:

x = x + 1 -- increment x by one
$obj.pos = $obj.pos * scale -- multiply $obj.pos by scale 

Corresponding to the four math operations ( + , - , * , and / ) are assignment operators that apply the operation to the assignment's destination and update the destination with the result.

Their syntax is:

<destination> += <expr> -- add <expr> to destination 
<destination> -= <expr> -- subtract <expr> from destination 
<destination> = <expr> -- multiply destination by <expr> 
<destination> = <expr> -- divide destination by <expr>

Using the shorthand form of assignment, the previous examples can be written as:

x += 1 -- increment x by one
$obj.pos *= scale -- multiply $obj.pos by scale