# INTERSECTION

### Description

The `INTERSECTION` function takes two lists and returns a new list containing only the elements that appear in **both** lists. Elements present in only one of the two lists are excluded from the result.

### Syntax

```
INTERSECTION(list_a, list_b)
```

**Returns:** A list of elements that exist in both `list_a` and `list_b`.

### Example

```
p is Person
INTERSECTION(p.countries_lived_in, p.nationalities)
```

This returns the countries the person has both lived in and holds a nationality for. For example, if a person has lived in Germany, Switzerland, and Italy, but only holds German nationality, the result would be `[Germany]`.


---

# 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/intersection.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.
