# SORT

### Description

`SORT` will sort the elements in a list. It works on numbers as well as on text. If a string starts with a number will come before strings starting with letters.

### Example: Numbers

```
SORT([5, 76, 1])
```

This will return `[1, 5, 76]`.

### Example: Text

```
REVERSE(
    SORT(['Benjamin', 'Anna', 'Laura', 'Annabelle'])
)
```

The sorting will return `['Anna', 'Annabelle', 'Benjamin', 'Laura']`, which is then reversed, so the whole expression returns `['Laura', 'Benjamin', 'Annabelle', 'Anna']`

### Example: Text with Numbers

```
SORT(['Snow White', '101 Dalmatians', 'Aladdin'])
```

In this example, one string starts with a number. It will therefore come before the strings starting with letters, so this expression will return `['101 Dalmatians', 'Aladdin', 'Snow White']`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.atfinity.io/rule-language/operators/list-operators/sort.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
