- This wiki is out of date, use the continuation of this wiki instead
Sort
From FenixWiki
Contents |
Definition
STRING sort ( <VARSPACE array> , [<INT datacount>] )
Sorts an array by sorting a certain number of elements. By default the whole array is sorted.
Parameters
VARSPACE array | - The array to be sorted. |
[INT datacount] | - Number of elements to sort. |
Returns
INT: true
Example
Program sorting; Const myarray_length = 10; Global int myarray[myarray_length-1]; Begin // Insert random numbers for(x=0; x<myarray_length; x++) myarray[x] = rand(0,100); end // Show array say("--------------------"); for(x=0; x<myarray_length; x++) say(x + " - " + myarray[x]); end // Sort sort(myarray); // Show array say("--------------------"); for(x=0; x<myarray_length; x++) say(x + " - " + myarray[x]); end // Wait until ESC is pressed Repeat frame; Until(key(_esc)) End