# filter()

### Description

With `filter()` you can apply a conditional expression to a list and only keep elements where the filter return true.

### Example

```
[true, true, false].filter(value => value != true)
```

This filters out all the `true` values in the list evaluating to `[false]`.

```
[1, 4, 2, 1, 3, 1, 4].filter(number => number > 2)
```

This removes elements smaller or equal to 2 from the list evaluating to `[4, 3, 4]`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.atfinity.io/rule-language/operators/list-operators/filter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
