Go to: Synopsis. Return value. MEL examples.

Synopsis

sort any[]

sort is NOT undoable, NOT queryable, and NOT editable.

Returns an array containing the elements of the input array sorted in ascending order.

Return value

any[]An array of the same type and number of elements as the input argument.

MEL examples

ls -dag ;
// Result: top topShape front frontShape side sideShape //

$mySortedList=sort(`ls -dag`);
// Result: front frontShape side sideShape top topShape  //

$listOfFloats={42.42, 1.2, 8.4, -3.4, -100};
$listOfFloats = `sort $listOfFloats`;
// Result: -100 -3.4 1.2 8.4 42.42 //

print $listOfFloats;
// -100
// -3.4
// 1.2
// 8.4
// 42.42