> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrics-man.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Last

# \$last

The `$last` operator returns the last element of an array.

## Input

* A single array value

## Output

* The last element of the array, or null if the array is empty

## Examples

### Get Last Element

```json theme={null}
{
  "$last": [
    [1, 2, 3, 4, 5]
  ]
}
```

Result: `5`

### From Field

```json theme={null}
{
  "$last": [
    {
      "$input": "items"
    }
  ]
}
```

Result: The last element of the items field array, or null if the array is empty
