Sort

 List Manipulations - Sort

The Sort Deluge list syntax sorts the elements in the list in the ascending or descending order, based on the option selected. You can also set the sort order to be dynamic, based on the value returned by a boolean expression. If the boolean expression returns "true" the list values will be sorted in the ascending order. If the boolean expression returms "false", the list values will be sorted in the decending order.

 Syntax

<list>.sort(<boolean>);

where,

<list> refers to the list name which has to be sorted.
<boolean> - the boolean value based on which the list elements will be sorted either in ascending/descending order.

 Example

In the following sample code, the sort order boolean value is specified directly.

sports_list.sort(true);

In the following sample code, the sort order will be decided based on the value returned by the boolean expression.

sports_list.sort(input.selection=="ascending");