Array Literals

An array in MAXScript is an ordered collection of values. Each element in the array can contain any type of value, and you can index and iterate an array. You can write array literals directly in a program or build the collection with the array functions provided in MAXScript. For details, see Array Values. Array literals can be expressed in two forms:

#( <expr> { , <expr> } )

#()                       -- empty array

Examples:

#(1, 2, 3)

#()

#(1,"foo",#(1.2, -4,#fred),[1,2,3]) -- this one has a nested array

Expressions in an array literal are evaluated when the literal is built. The following script and results show the values stored in an array when expressions are used in the literal:

Script:

a=10

x=45

#(1, sin x, a * 2.3)       -- can contain expressions

Output:

10.0

45

#(1, 0.707107, 23.0)