Arrays
You can declare local, module, and global variables with up to three dimensions as arrays for all data types.
To declare an array, use this syntax:
dataType name ( ubound1 [ , ubound2 [ , ubound3] ] )
SPEL+ arrays are zero based. The first element is referenced with a value of zero.
The total available number of array elements for local variables is 200 for strings and 2000 for all other types.
The total available number of array elements for global preserve variables is 400 for strings and 4000 for all other types.
The total available number of array elements for global and module variables is 10,000 for strings and 100,000 for all other types.
To calculate the total elements used in an array, use the following formula. (If a dimension is not used, substitute 0 for the ubound values.)
total elements = (ubound1 + 1) * (ubound2 + 1) * (ubound3 + 1)
Array declaration examples:
' Global string array
Global String gData$(10)
Function main
' Arrays local to this function
Integer intArray(10)
Real coords(20, 10)
Use Redim to change the bounds of an array at run time.
Integer a(10)
Redim a(20)
To preserve values when using Redim, add the Preserve optional argument.
Integer a(10)
Redim Preserve a(20)
Use UBound to get the maximum element number.
Integer i, a(10)
For i = 1 to UBound(a)
a(i) = i
Next i