# remove

> Documentation index: http://docs.tenzir.com/llms.txt

Removes all occurrences of an element from a list.

```tql
remove(xs:list, x:any) -> list
```

## Description

The `remove` function returns the list `xs` with all occurrences of `x` removed. If `x` is not present in the list, the original list is returned unchanged.

### `xs: list`

A list to remove elements from.

### `x: any`

The value to remove from the list.

## Examples

### Remove an element from a list

```tql
from {xs: [1, 2, 3, 2, 4]}
xs = xs.remove(2)
```

```tql
{xs: [1, 3, 4]}
```

### Remove a non-existent element

```tql
from {xs: [1, 2, 3]}
xs = xs.remove(5)
```

```tql
{xs: [1, 2, 3]}
```

### Remove from a list with strings

```tql
from {xs: ["apple", "banana", "apple", "orange"]}
xs = xs.remove("apple")
```

```tql
{xs: ["banana", "orange"]}
```

## See Also

* [`add`](http://docs.tenzir.com/reference/functions/add.md)
* [`append`](http://docs.tenzir.com/reference/functions/append.md)
* [`distinct`](http://docs.tenzir.com/reference/functions/distinct.md)
* [`prepend`](http://docs.tenzir.com/reference/functions/prepend.md)
* [Shape lists](http://docs.tenzir.com/guides/transformation/shape-lists.md)