# require_not_empty · Rell standard library · Chromia Docs (concept)

> pure function require_ not_ empty<T>(value: list <T>?, [message: text ]): list <T> Asserts that a list is non-null and non-empty. Parameters value — the li

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

FUNCTION

# require\_not\_empty

```signature
pure function require_not_empty<T>(value: list<T>?, [message: text]): list<T>
```

Asserts that a list is non-null and non-empty.

**Parameters**

* **value** — the list to be checked.
* **message** — the message for the exception to be thrown if the list is `null` or empty

**Returns**

the passed `value`, but with type cast from `list<T>?` to `list<T>`

**Throws**

* `exception` — if the provided list is `null` or empty

Since 0.9.0

---

```signature
pure function require_not_empty<T>(value: set<T>?, [message: text]): set<T>
```

Asserts that a set is non-null and non-empty.

**Parameters**

* **value** — the set to be checked
* **message** — the message for the exception to be thrown if the set is `null` or empty

**Returns**

the passed `value`, but with type cast from `set<T>?` to `set<T>`

**Throws**

* `exception` — if the provided set is `null` or empty

Since 0.9.0

---

```signature
pure function require_not_empty<K, V>(value: map<K, V>?, [message: text]): map<K, V>
```

Asserts that a map is non-null and non-empty.

**Parameters**

* **value** — the map to be checked
* **message** — the message for the exception to be thrown if the map is `null` or empty

**Returns**

the passed `value`, but with type cast from `map<K,V>?` to `map<K,V>`

**Throws**

* `exception` — if the provided map is `null` or empty

Since 0.9.0

---

```signature
pure function require_not_empty<T>(value: T?, [message: text]): T
```

Asserts that a value is non-null.

**Parameters**

* **value** — the nullable value to be checked
* **message** — the message for the exception to be thrown if the value is `null`

**Returns**

the passed `value`, but with type cast from `T?` to `T`

**Throws**

* `exception` — if the provided value is `null`

Since 0.9.0

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