> 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/usdcond.md).

# $cond

`$cond` operator lets you build conditions directly in CQL and returns you the item based on the condition passed in the object. You can use this in any [<mark style="color:blue;">**Expression Object**</mark>](/flow-builder/cql-cosmocloud-query-language/building-expressions.md).

## Syntax

```json
{
    "$cond": [ <condition>, <true_val>, <false_val> ]
}
```

### Properties

| Field         | Description                                                                                                                                                                                                                                                        | Required |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- |
| \<condition>  | <p>The <code>\<condition></code> can be any valid <a href="/pages/aJtci0lt5gcR4VOrIDr9"><mark style="color:blue;"><strong>condition object</strong></mark></a> as long as it resolves to a boolean object.</p><p></p><p>It can also be a Magical Autocomplete.</p> | true     |
| \<true\_val>  | <p>The value to return if the <code>\<condition></code> resolves to <code>true</code>. <br><br>It can also be a Magical Autocomplete.</p>                                                                                                                          | true     |
| \<false\_val> | <p>The value to return if the <code>\<condition></code> resolves to <code>false</code>. <br><br>It can also be a Magical Autocomplete.</p>                                                                                                                         | true     |

### Returns

`<object>` - Returns either the `<true_val>` or `<false_val>` based on the condition. The object type can be anything based on the values provided.

## Examples

### With Magical Autocomplete

Let's say we have declared a variable `country` in our API flow, which has an array value of `US` currently.

```json
{
    "$cond": [ 
        { "$eq": ["$.variables.country", "India"] },
        10,
        20
    ]
}
```

The above expression returns **20** as the condition becomes false.
