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

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/0%20\(163\).png)

### **Example**

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

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/1%20\(164\).png)

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

Where,

Condition: *Country* = “Germany”

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/2%20\(164\).png)

*thenValue* = True

*elseValue* ­ = False

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/3%20\(31\).png)

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

![](https://github.com/astera-software/Astera_Data_Stack_v9/blob/main/.gitbook/assets/4%20\(5\).png)
