ArrayDimensions
(Engine-Level Function)
Description: | Returns the number of dimensions in an array. |
Returns: | Numeric |
Usage: | Script or steady state. |
Function Groups: | Array |
Related to: | ArraySize | ArrayStart| Array Functions |
Format: | ArrayDimensions(Array) |
Parameters: |
Array |
Required Any array variable. |
Comments: | The ArrayDimensions function is useful for writing intelligent parameterized modules. The module can determine how many dimensions there are in an array that is passed to it. Note that ArrayDimensions will not drill down into nested array structures; that is to say, if a 3 dimensional array is created, and a 2 dimensional array is stored in each of its elements, ArrayDimensions will return a value of 3, not 5. This is because the data stored in different array elements does not need to be of the same type - one element could contain an array while another element could contain a simple value. |
An Invalid will be returned if a simple value is handed to ArrayDimensions().
Example:
x[10][3]; ... y = New(3, 0, 10); numDimX = ArrayDimensions(x); numDimY = ArrayDimensions(y);
In this example, numDimX will have a value of 2, while numDimY will have a value of 3.