Array Procedures

Array procedures operate on a given array. Unlike functions, they do not return a value. Rather, they modify the actual array which is supplied to the procedure.

sort

Sorts the elements of the array. The array's element type must have a defined sort order.

Arguments
Array
array to be sorted
Result The array with the elements sorted in ascending order. If the array contains null elements, an error will be thrown.
The following will display [2, 3, 5, 7]:
myArray as Int [] = [7, 3, 5, 2]
sort myArray
display myArray

clear

Clears all the elements of the array.

Arguments
Array
array to be cleared
Result The array with no elements.
The following will result in an empty array:
myArray as Int [] = [7, 3, 5, 2]
clear myArray

insert

Inserts an element in the specified position.

Arguments
Array
array in which an element will be inserted
Integer
index after which the element is to be inserted
Any
a value of the same type as the array
Result The array with no elements.
The following will result in myArray being changed to [2, 9, 7, 3, 4]:
myArray as Int[] = [2, 7, 3, 4]
insert myArray
    using int = 1, 
    value = 9
display myArray