Support

Equilla Formula Language

SortArray

Sorts the elements of the array. If the order is not specified, they are sorted in ascending order.

Inputs

Array
ArrayRef: The array to sort.
Order
Boolean: (Optional) Sort the array elements in ascending order.

Examples

Sort an array in ascending order
Array: myDynamicArray[]; FillArray(myDynamicArray, 4, 3, 1, 2); SortArray(myDynamicArray); print(myDynamicArray); // prints 1 2 3 4
Sort an array in descending order
Array: myDynamicArray[]; FillArray(myDynamicArray, 4, 3, 1, 2); SortArray(myDynamicArray, false); print(myDynamicArray); // prints 4 3 2 1
Sort first three elements in ascending order
Array: myDynamicArray[]; FillArray(myDynamicArray, 4, 3, 1, 2); SortArray(myDynamicArray, 3, true); print(myDynamicArray); // prints 1 3 4 2