> 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/if.md).

# IF

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

Tests `condition` and returns `then` if `condition` is `true` and `else` if `condition` is `false`

### Arguments

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

### Output

Outputs `then` if `condition` is `true` and `else` if `condition` is `false`

### Example

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