GetArraySize

Arrays
Aptilis 1

GetArraySize(ArrayName[])

GetArraySize simply returns the number of elements of an array.
Arrays are created automatically when you first use them. They are made big enough so that they will be able to contain all your data. In the same fashion, you do not need to worry about resizing your arrays, because if you refer to an element outside the boundaries of the array, the array is automatically expanded.
For instance:
a[11] = 5 An array with 12 elements is created, (Arrays start at 0)
print(a[2]) An empty string is returned
print(a[20]) Nothing happens, we're just reading, no need to expand
a[22]= "hello"$ The array is automatically expanded to 23 elements, all is cool.

Return value:
array size.

Example:

a[0]="Apple" $
a[10]="Banana" $
a[20]="Cherry" $

n = GetArraySize(a[])
print(n)
Result:
21

See also Setarrayindex, GetNext, GetPrevious, ClearArray.