Product Site

5.3.6. Array Class

An Array is a possibly sparse collection with indexes that are positive whole numbers. You can reference Array items by using one or more indexes. The number of indexes is the same as the number of dimensions of the Array. This number is called the dimensionality of the Array.

Array items can be any valid Rexx object.
Table 5.16. Array Class

Array objects are variable-sized. The dimensionality of an array is fixed, but the size of each dimension is variable. When you create an array, you can specify a hint about how many elements you expect to put into the array or the array's dimensionality. However, you do not need to specify a size or dimensionality of an array when you are creating it. You can use any whole-number indexes to reference items in an array.

For any array method that takes an index, the index may be specified as either individual arguments or as an array of indexes. For example, the following are equivalent:
Example 5.162. Array class — [] method
    x = myarray[1,2,3]   -- retrieves an item from a &multidimarray;
    index = .array~of(1,2,3)  -- create an index list
    x = myarray[index]   -- also retrieves from "1,2,3"

Methods such as index that return index items will return a single numeric value for single-dimensional Arrays and an array of indexes for multi-dimensional Arrays.