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

> function add(index: integer , value: T): boolean Insert a value at the specified index. Any elements previously occurring at and after the specified
index 

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

FUNCTION

# list.add

```signature
function add(index: integer, value: T): boolean
```

Insert a value at the specified index. Any elements previously occurring at and after the specified
index have their indices increased by 1, and the size of the list increases by 1.

Note that for a list `my_list`:

* `my_list.add(my_list.size(), x)` "appends" `x` to the end of the list
* `my_list.add(my_list.size() + 1, x)` throws an exception

Note also that `my_list.add(my_list.size(), x)` is equivalent to `my_list.add(x)` (inherited from
`collection<T>`).

**Parameters**

* **index** — The index at which to add the element.
* **value** — The value to add.

**Returns**

`true`

**Throws**

* `exception` — if the index is out of bounds

Since 0.6.0

---

```signature
function add(value: T): boolean
```

Append an element to the end of this collection.

The element is not added if this collection does not allow duplicates and the element is already
contained in this collection.

**Parameters**

* **value** — the element to add

**Returns**

`true` if the element was added, `false` otherwise

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/add.html)Generated API reference, mirrored from the live docs
