> For the complete documentation index, see [llms.txt](https://docs.documint.me/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.documint.me/templates/working-with-dynamic-data/functions-and-operators/operators/logical-operators.md).

# Logical Operators

Logical operators can be used in conjunction with `#if` statements and other operators to perform logical checks.

### and

`{{$and arg1 arg2 ...}}`

Returns `true` if all `arguments` evaluate to `true`

**Arguments**

<table><thead><tr><th width="152">Name</th><th width="272.5333333333333">Description</th><th width="150">Type<select multiple><option value="b0403385da1b4af9a8a894cb7cfa1e88" label="String" color="blue"></option><option value="6a3ca9c830be4cd5a2bcf10d17c44f82" label="Number" color="blue"></option><option value="011b91dfe58a400894b04549ec4f9e02" label="Boolean" color="blue"></option><option value="3c1342f6b38a46e39064bd88015df50d" label="Any" color="blue"></option><option value="331ed19046194ceda3a4dc3fc0789b8f" label="String Array" color="blue"></option><option value="90054e941c4a42189f24f740853acb64" label="Number Array" color="blue"></option><option value="faca2fa5943441089b26f8f93d7d11a2" label="Boolean Array" color="blue"></option></select></th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>arg1</td><td>1st argument to evaluate</td><td><span data-option="011b91dfe58a400894b04549ec4f9e02">Boolean</span></td><td>true</td></tr><tr><td>arg2</td><td>2nd argument to evaluate</td><td><span data-option="011b91dfe58a400894b04549ec4f9e02">Boolean</span></td><td>true</td></tr><tr><td>...</td><td>Remaining arguments to evaluate</td><td><span data-option="011b91dfe58a400894b04549ec4f9e02">Boolean</span></td><td>false</td></tr></tbody></table>

**Returns**

&#x20; *(*[*Boolean*](/legacy-documentation/data-and-variables/data-types.md#booleans)*)*

**Example**

This example checks if the `qty` is greater than 5 *and* the `amount` is less than 200

{% tabs %}
{% tab title="Template" %}
{{$and ($gt qty 5) ($lt amount 200) }}
{% endtab %}

{% tab title="Data" %}

```
{
    "amount": 150,
    "qty": 4
}
```

{% endtab %}

{% tab title="Result" %}
true
{% endtab %}
{% endtabs %}

### or

`{{$or arg1 arg2 ...}}`

Returns `true` if any of the `arguments` evaluate to `true`

**Arguments**

<table><thead><tr><th width="152">Name</th><th width="272.5333333333333">Description</th><th width="150">Type<select multiple><option value="b0403385da1b4af9a8a894cb7cfa1e88" label="String" color="blue"></option><option value="6a3ca9c830be4cd5a2bcf10d17c44f82" label="Number" color="blue"></option><option value="011b91dfe58a400894b04549ec4f9e02" label="Boolean" color="blue"></option><option value="3c1342f6b38a46e39064bd88015df50d" label="Any" color="blue"></option><option value="331ed19046194ceda3a4dc3fc0789b8f" label="String Array" color="blue"></option><option value="90054e941c4a42189f24f740853acb64" label="Number Array" color="blue"></option><option value="faca2fa5943441089b26f8f93d7d11a2" label="Boolean Array" color="blue"></option></select></th><th data-type="checkbox">Required</th></tr></thead><tbody><tr><td>arg1</td><td>1st argument to evaluate</td><td><span data-option="011b91dfe58a400894b04549ec4f9e02">Boolean</span></td><td>true</td></tr><tr><td>arg2</td><td>2nd argument to evaluate</td><td><span data-option="011b91dfe58a400894b04549ec4f9e02">Boolean</span></td><td>true</td></tr><tr><td>...</td><td>Remaining arguments to evaluate</td><td><span data-option="011b91dfe58a400894b04549ec4f9e02">Boolean</span></td><td>false</td></tr></tbody></table>

**Returns**

&#x20; *(*[*Boolean*](/legacy-documentation/data-and-variables/data-types.md#booleans)*)*

**Example**

This example checks if the `qty` is greater than 5 *or* the `amount` is less than 200

{% tabs %}
{% tab title="Template" %}
{{$or ($gt qty 5) ($lt amount 200) }}
{% endtab %}

{% tab title="Data" %}

```
{
    "amount": 500,
    "qty": 4
}
```

{% endtab %}

{% tab title="Result" %}
true
{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.documint.me/templates/working-with-dynamic-data/functions-and-operators/operators/logical-operators.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
