Lingo Dictionary > S > sort |  |

sort

Syntax

    list.sort()
    sort list

Description

Command; puts list items into alphanumeric order.

| When the list is a linear list, the list is sorted by values.
| When the list is a property list, the list is sorted alphabetically by properties.

After a list is sorted, it maintains its sort order even when you add new variables using the `add` command.

Example

This statement puts the list Values, which consists of [`#a: 1, #d: 2, #c: 3`], into alphanumeric order. The result appears below the statement.

    put values
    -- [#a: 1, #d: 2, #c: 3]
    values.sort()
    put values
    --[#a: 1, #c: 3, #d: 2]