### 14.2.2. Conditional if Statement

CEL supports the conditional if statement using the following syntax:

`if( cond_expr, true_expr, false_expr )`

where:

- `cond_expr`: is the logical expression used as the conditional test

- `true_expr`: is the mathematical expression used to determine the result if the conditional test is `true`.

- `false_expr` : is the mathematical expression used to determine the result if the conditional test is `false`.

Note: The expressions `true_expr` and `false_expr` are always evaluated independent of whether the evaluation of `cond_expr` is `true` or `false`. As a consequence, a conditional statement cannot be used to avoid division by zero as in `if( x>0, 1/x, 1.0)`. In this case, when `x=0.0`, a division by zero will still occur because the expression `1/x` is evaluated independent of whether `x>0` is satisfied or not.

Release 18.2 - © ANSYS, Inc. All rights reserved.