The Sort Deluge list syntax sorts the elements in a list in the ascending or descending order, based on the returned boolean value. If the boolean expression returns true the list values will be sorted in the ascending order. If the boolean expression returns false, the list values will be sorted in the decending order. You can also set the sort order to be dynamic, based on the value/parameter passed to the function.
<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.
1) In the following sample code, the sort order boolean value is specified directly.
sports_list.sort(true); //sorts in ascending order
2) In the following sample code, the sort order will be decided based on the value returned by the boolean expression. Lets say we have a form with a field Support Tickets which lists options Pending Tickets and Fixed Tickets. If the option selected by the user matches the specified option in the code, i.e. "Pending Tickets", then the boolean value returned is true and the list is sorted in ascending order. If the entered option does not match with "Pending Tickets", then the boolean value returned is false and the list is sorted in descending order