Next: Referencing Arrays, Previous: Specifying Arrays, Up: Arrays [Contents][Index]

Arrays can be combined into a single, bigger array through the
`concat`

(concat) or `[]`

(Square Brackets)
functions, if each dimension but the last is the same in all component
arrays. In this function, a scalar is treated as a one-dimensional
array with only one element. For instance, we can combine a 3-element
array with a scalar to get a 4-element array. The following two
assignments yield the same result:

x = [[3, 4, 5], 12] x = [3, 4, 5, 12]

Arrays can be endowed with an extra dimension by applying the
`concat`

or `[]`

function to that array alone. For instance,

y = [[3, 4, 5]]

defines a two-dimensional array, with dimensions 3 by 1. Also legal are the following assignments:

z = [y, y] a = [z, y]

which define a 3-by-2 and a 3-by-3 array, respectively.