Appending a New Element to an Existing Array
- Last UpdatedNov 10, 2025
- 1 minute read
-
To set a new element at the end of an existing array without needing to know which elements are already set, use the Append() method as follows:
!Result.Append(!NewValue)
The new array element to be created is determined automatically by adding 1 to the highest existing index for the array !Result. The data are stored in !Result[1] if the array does not yet contain any elements.
The array !Result must exist before you can call this method. If necessary you can create an empty array (with no elements) beforehand:
!Result = ARRAY()
If !Result exists already as a simple variable, you will get an error and the command is ignored.