Subarray method: Array class

Syntax

Subarray(start, length)

Description

The Subarray method creates a new array from an existing one, taking the elements from start for a total of length. If length if omitted, all elements from start to the end of the array are used.

If the array is multi-dimensional, the subarrays of the created array are references to the same subarrays from the existing array. This means if you make changes to the original subarrays, the referenced subarrays are also changed. To make distinct subarrays, use the Clone method.

Parameters

Parameter Description

start

Specifies where in the array to begin the subarray.

length

Specifies the number of elements in the array to be part of the subarray.

Returns

An array object.

Example

To make a distinct array from a multi-dimensional array, use the following:

&A = &AAN.Subarray(1, 2).Clone();

Related Topics