Type-Free Variables

Variables can hold any type of value, and the value type they hold can change from assignment to assignment. For example, you can store a point3 value, then a float value, and then an array to the same variable. The variables in MAXScript are known as type-free variables, unlike variables in C or Java, which can only hold values of a particular declared type. This freedom makes scripting simpler and more exploratory.

As well as being type-free, variables in MAXScript are also type-safe. This means you cannot perform the wrong operation on a value in a variable, as shown in the following example, where MAXScript prints an error message following the invalid operation:

   x = $Box01.position -- a point3 value
   x = "foo" -- a string value
   x = x + 2 -- try to add a number to a string
   Error: Unable to convert 2 to type String