# Every quantifier

Learn how to check that all items in a collection satisfy a condition.

This checks whether all elements in a collection satisfy a given condition.

Note that this quantifier always returns true for empty collections. This is known in logic as [vacuous truth](https://en.wikipedia.org/wiki/Vacuous_truth), meaning that the quantifier is satisfied because there are no elements in the collection that do not satisfy the condition.

> **Is every unicorn in the room shining?**
>
> This might sound funny, but since there are no unicorns in the room, there's no unicorn that isn't shining. So, technically, they all are!

## Syntax

This quantifier has the following syntax:

```cql
every /*<item>*/ in /*<collection>*/ satisfies /*<condition>*/
```

Either *satisfy* or *satisfies* can be used interchangeably:

```cql
every /*<item>*/ in /*<collection>*/ satisfy /*<condition>*/
```

You can also specify a name to refer to the index of the element in the collection:

```cql
every /*<item>*/ in /*<collection>*/ indexed by /*<index>*/ satisfies /*<condition>*/
```

You must replace the `/*<item>*/` and `/*<index>*/` placeholders with a [valid identifier](/reference/cql/syntax#identifiers). These variables will refer to the element and its index in the collection, as exemplified in the following section.

## Examples

Here is a basic example that checks if all numbers in a collection are even:

```cql
every number in [2, 4, 6] satisfies number mod 2 is 0 // true
```

The following example shows how to use the index of the element in the condition:

```cql
every item in cart indexed by index satisfies item's brand is "Apple" and index >= 1
```

In the above example, it checks whether the user only added Apple products as the second or subsequent item in the cart.
