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

# Logic

### AND

*Boolean AND operator will be true if and only all the operators are `true`.*

#### Expression:

<`boolean`> AND <`boolean`>

#### Return:

boolean

#### Example of usage:

```javascript
true AND 6 > 5

Return value:
true
```

### OR

*Boolean OR operator will be true if and only the conjunction of all the operators is `true`.*

#### Expression:

<`boolean`> OR <`boolean`>

#### Return:

boolean

#### Example of usage:

```javascript
false OR ("smaug" == null)

Return value:
false
```

### IF

*IF the condition evaluates to true THEN the result equals the `first expression`; ELSE, the `second expression` will proceed.*

#### Expression:

IF(*expression*: boolean, *then*: any, *else*: any)

#### Return:

*then*: any || *else*: any

#### Example of usage:

```javascript
IF("bilbo" == "baggins", "This is true", "This is false")

Return value:
"This is false"
```

### Switch

Returns first expression where the value matches appropriate right operand.

#### Expression:

**SWITCH**(*value*: any\[, switchOperand: number, *expression*: any ], *default*?: any)

#### Return:

*any*

#### Example of usage:

```javascript
SWITCH(2, 1, "apples", 2, "pears", 3, "oranges", "no fruits")

Return value:
"pears"
```


---

# 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.adapptio.com/reference-guide/functions/logic.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.
