> For the complete documentation index, see [llms.txt](https://documentation.astera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.astera.com/astera-data-stack-v10/functions/logical/if-boolean.md).

# If (Boolean)

| **Name**    | ***If (Boolean)***                                                                                                                                                                                                                                                                |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax      | If (Boolean condition, Boolean thenValue, Boolean elseValue)                                                                                                                                                                                                                      |
| Purpose     | To evaluate a given condition and if true, return result of thenValue. Otherwise, to return the result of elseValue.                                                                                                                                                              |
| Description | Returns the value of ‘Then’ expression or ‘Else’ expression depending on the value of condition.                                                                                                                                                                                  |
| Return Type | Boolean                                                                                                                                                                                                                                                                           |
| Parameters  | <p>Condition \[System.Boolean]</p><p>thenValue \[System.Boolean] – This Parameter’s value is returned if the result of ‘condition’ parameter is true.</p><p>elseValue \[System.Boolean] - This Parameter’s value is returned if the result of ‘condition’ parameter is false.</p> |

![](/files/n6kfpwo5YeQI2mrKQvu3)

### **Example**

We have a *Customers* dataset which we will use to evaluate whether the *Country* field consists of the value “Germany”.

![](/files/vLT3sn5qR708PuoHahou)

We will use the *Expression* object to give this condition, and a *Variables* object to define *thenValue* and *elseValue*.

Where,

Condition: *Country* = “Germany”

![](/files/LdUZr8kX1lmjBLJN1kIz)

*thenValue* = True

*elseValue* ­ = False

![](/files/0ZtiQuatdNfoXixInjwl)

In the output, you can see that Boolean values, True and false, have been returned depending on whether the *Country* field condition was met.

![](/files/Gd2Znlag4aZCe7EqIP9Y)


---

# 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://documentation.astera.com/astera-data-stack-v10/functions/logical/if-boolean.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.
