> For the complete documentation index, see [llms.txt](https://docs.valq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.valq.com/model/formula-functions/logical-functions.md).

# Logical Functions

<table><thead><tr><th width="117">NAME</th><th width="309">SYNTAX</th><th>DESCRIPTION</th></tr></thead><tbody><tr><td><a href="/pages/4QlpTRgJWa1duB8nckby">IF</a></td><td>IF(logical_test, value_if_true, value_if_false)</td><td>Checks whether a condition is met and returns the first value if TRUE and second value if FALSE.</td></tr><tr><td><a href="/pages/HPzyl9LrCak2mvA9zbEg">SWITCH</a></td><td>SWITCH(expression, value1, result1, value2, result2, ...,value_n, result_n, default?)</td><td>Evaluates an expression against a list of values and returns the result corresponding to the first matching value. If there is no match, an optional default value is returned.</td></tr><tr><td><a href="/pages/sP2oYy6ouv1pQEVg9haS">AND</a></td><td>AND(logical_test1,...logical_test2?)</td><td>Checks whether all the arguments are TRUE, and returns TRUE only if all the arguments are TRUE</td></tr><tr><td><a href="/pages/d9l8RYRktXvEdGwDGAL0">OR</a></td><td>OR(logical_test1,...logical_test2?)</td><td>Checks whether any of the arguments are TRUE, and returns TRUE or FALSE. Returns FALSE only if all the arguments are FALSE</td></tr><tr><td><a href="/pages/Ma9jNoAg770oVMAqLooL">NOT</a></td><td>NOT(logical_test)</td><td>Reverses FALSE to TRUE, or TRUE to FALSE</td></tr><tr><td><a href="/pages/1CP1svWLXnzG7OKR3Hr9">XOR</a></td><td>XOR(logical_test1,...logical_test2?)</td><td>Returns a logical 'Exclusive Or' of all the arguments</td></tr><tr><td><a href="/pages/2bV9zS5A5TeaAbxccgkc">IFNAN</a></td><td>IFNAN(value1,value2?:number) - > number</td><td>Returns a default value if the value in the node is an error</td></tr></tbody></table>


---

# 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:

```
GET https://docs.valq.com/model/formula-functions/logical-functions.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.
