> For the complete documentation index, see [llms.txt](https://docs.cosmocloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cosmocloud.io/flow-builder/cql-cosmocloud-query-language/building-expressions/usdmod.md).

# $mod

`$mod` operator helps you in finding the modules value in an given array expression. You can use this in any [<mark style="color:blue;">**Expression Object**</mark>](/flow-builder/cql-cosmocloud-query-language/building-expressions.md).

## Syntax

```json
{
    "$mod":[ <divider> , <dividend> ]
}
```

### Properties

| Field                  | Description                  | Required                                                                                                                                                                                                                                              |      |
| ---------------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- |
| \<divider \| dividend> | <p>The <code><</code>divider | dividend<code>></code> expression can be any valid <a href="/pages/E96SHGHwhXp256hQZFJ6"><mark style="color:blue;"><strong>expression</strong></mark></a> as long as it resolves to a number.</p><p></p><p>It can also be a Magical Autocomplete.</p> | true |

### Returns

`number` - The result of $max operation

## Examples

### Basic example

```json
{
    "$mod": [5,2]
}
```

The above expression returns **1**

### With Nested Expressions

```json
{
    "$mod": [
        { "$add" : [1,2] },
        { "$pow" : [2,2] },
    ]
}
```

The above expression calculates the nested expression, return **3,4** respectively in its place and then the outer `$mod` expression returns **3** overall.

### With Magical Autocomplete

Let's say we have declared a variable `temp` in our API flow, which has a value of `[5, 4]` currently.

```json
{
    "$max":"$.variables.temp"
}
```

The above expression would resolve to a result of **1**
