Description
Sort a list of integers numbers stored in an array.
Functional area
System
Command syntax
Syntax
sortInts intArray [-d] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
intArray | integer array | yes | The array to sort |
Flags
Name | Flag arguments | Argument type | Exclusive to | Comments |
---|---|---|---|---|
d | 0 | — | — | Sorts in descending order. Default is to sort in ascending order. |
Return value
integer array
Returns the sorted array.
Examples
// Demonstrate a simple sort.
int $array[3];
$array[0] = 3;
$array[1] = -1;
$array[2] = 10;
int $sortedArray[] = `sortInts $array`;
print $sortedArray;