> 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="/model/formula-functions/logical-functions/if.md">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="/model/formula-functions/logical-functions/switch.md">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="/model/formula-functions/logical-functions/and.md">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="/model/formula-functions/logical-functions/or.md">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="/model/formula-functions/logical-functions/not.md">NOT</a></td><td>NOT(logical_test)</td><td>Reverses FALSE to TRUE, or TRUE to FALSE</td></tr><tr><td><a href="/model/formula-functions/logical-functions/xor.md">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="/model/formula-functions/logical-functions/ifnan.md">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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.valq.com/model/formula-functions/logical-functions.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
