# `arrayRemove`

## Description

Returns a new array with the specified element removed.

- The element type must match the array type.
- Supported element types include `string`, `bool`, `number`, `interval`, `timestamp`, `regexp`, and `enum`.

## Syntax

Like many functions in DataPrime, `arrayRemove` supports [two notations](https://coralogix.com/docs/dataprime/language-reference/functions-reference/index.md), **function** and **method** notation. These interchangeable forms allow flexibility in how you structure expressions.

```dataprime
arrayRemove(array: array<T>, element: T): array<T>
```

```dataprime
(array: array<T>).arrayRemove(element: T): array<T>
```

## Arguments

| Name    | Type  | Required | Description                                      |
| ------- | ----- | -------- | ------------------------------------------------ |
| array   | array | **true** | The array to modify                              |
| element | T     | **true** | The element to remove, must match the array type |

## Example

**Use case: Remove an item from a queue**

Suppose you have a queue of jobs and want to remove one element. Consider the following input:

```json
{
    "values": ["Job 1", "Job 2", "Job 3", "Job 4"]
}
```

By removing `'Job 3'`, the array is updated to exclude that job.

### Example query

```dataprime
replace values with arrayRemove(values, 'Job 3')
```

```dataprime
replace values with values.arrayRemove('Job 3')
```

### Example output

The result will include the updated array without the removed element:

```json
{
    "values": ["Job 1", "Job 2", "Job 4"]
}
```
