# 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://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/m6bf3agW80uGRf66PvAI/0.png)

### **Example**

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

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/oNDC8HoZqztxIubLBd4a/1.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://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/itAAy2nZk681jXRI0dkg/2.png)

*thenValue* = True

*elseValue* ­ = False

![](https://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/ScQArt7tPGPOGDUXp590/3.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://content.gitbook.com/content/zEifS4h8yurLAAwiGNX2/blobs/9eCRLuUQ1zqlT6mHwJ3w/4.png)
