> For the complete documentation index, see [llms.txt](https://docs.cascade.io/cascade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cascade.io/cascade/functions-and-expressions/functions/logical/iif.md).

# IIF

IF( `condition`, `then`, `else`, `when null`)

Tests `condition` and returns `then` if `condition` is `true`, `else` if condition if false, and a `when null` value if null.

### Arguments

| Argument    | Description                              |
| ----------- | ---------------------------------------- |
| `condition` | Boolean expression to test               |
| `then`      | What to return if `true`                 |
| `else`      | What to return if `false`                |
| `when null` | What to return if `condition` is unknown |

### Output

Outputs `then` if `condition` is true, `else` if `condition` is false, and a `when null` value if `condition` is null.

### Example

{% embed url="<https://datawrapper.dwcdn.net/QBq2Q/1>" %}
