ARAP handles arrays as a special case of an otherwise normal Global Variable. Local Variables and Pre-Defined Variables cannot be used to manipulate arrays.
Arrays are stored as a "delimited" string. The current value of the ARRAYDELIMITER variable is used to indicate the delimiter. The default delimiter is the "return" character (ASCII 13) - in which case the "linefeed" character is ignored. Commonly used delimiters are comma, space, and tab characters. If the delimiter is a space, the non-blocking space character (hex A0) is also used. If the array delimiter has more than one character, only the first character is used,
The array index starts with 1. Array index 0 returns the number of elements in the array. Accessing an array element that does not exist will return the value "BAD_ARRAY_INDEX". If the array index is not a valid integer a value of "BAD_VARIABLE" is returned.
Since variables are just strings, array elements can store any data type (boolean, string, integer, floating point number, etc.).
- Individual array elements cannot be set if the array variable does not previous exist.
- You cannot set an array element whose index is larger than the number of elements currently in the array. Set the size of an array first (eg. ARRAYNAME= 5)
Example array usage (with an array named ARRAYNAME):
Set the current array delimiter (eg. to tab):
Get number of array elements:
Get value of element 'index':
Get value of element from variable INDEX:
Set the value of constant element (eg. element 5):
Set the value of variable element (eg. element INDEX):
Setting the number of elements in an array (note, this clears the array values):
Setting several elements of an array in one step (eg. with comma delimiter):