# If (Double)

| **Name**    | ***If (Double)***                                                                                                                                                                                                                                                                                             |
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Syntax      | If (Boolean condition, Real thenValue, Real 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 | Double                                                                                                                                                                                                                                                                                                        |
| Parameters  | <p>Condition \[System.Boolean] – Condition that is evaluated</p><p>thenValue \[System.Double] – This Parameter’s value is returned if the result of ‘condition’ parameter is true.</p><p>elseValue \[System.Double] - 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\(10\).png)

### **Example**

We have a *Customers* dataset which we will use to evaluate and transform the *Items* field.

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

In this example we will use the *Expression* object to define the condition, and a *Variables* object to define a real *thenValue* and a real *elseValue*.

Where,

Condition: *Items* = “1”

*thenValue* = 1.23

*elseValue* ­ = 2.23

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

In the output, you can see that real values, 1.23 and 2.23, have been returned depending on whether the *Items* field condition was met.

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