# list.sub · Rell standard library · Chromia Docs (concept)

> pure function sub(start: integer ): list <T> Returns a sublist of this list starting from the specified index (inclusive). Equivalent to list.sub(index, li

Source: https://docs.chromia.com/pages/rell-stdlib/-rell-system-library/root/list/sub/

FUNCTION

# list.sub

```signature
pure function sub(start: integer): list<T>
```

Returns a sublist of this list starting from the specified index (inclusive).

Equivalent to `list.sub(index, list.size())`.

Note that:

* `my_list.sub(my_list.size() - 1)` returns a list containing only the last element of `my_list`
  (assuming `my_list.size > 0`)
* `my_list.sub(my_list.size())` returns an empty list
* `my_list.sub(my_list.size() + 1)` throws an exception

**Parameters**

* **start** — the starting index of the sublist (inclusive)

**Throws**

* `exception` — if the `start` index greater than this list's size

Since 0.6.0

---

```signature
pure function sub(start: integer, end: integer): list<T>
```

Returns a sublist of this list starting from the specified start index (inclusive) to the specified
end index (exclusive).

For the list `my_list`, `my_list.sub(start, my_list.size())` is equivalent to `my_list.sub(start)`.

**Parameters**

* **start** — the start index of the sublist (inclusive)
* **end** — the end index of the sublist (exclusive)

**Throws**

* `exception` — when: - the `start` or `end` indexes are greater than this list's size - the `start` index is greater than the `end` index

Since 0.6.0

[View this page on docs.chromia.com](https://docs.chromia.com/pages/rell-stdlib/-rell%20-system%20-library/%5Broot%5D/list/sub.html)Generated API reference, mirrored from the live docs
