> 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/cascade-faqs/functions-and-expressions/how-to-write-an-if-statement-in-cascade.md).

# How to write an IF Statement in Cascade

If you’re familiar with generic Excel [IF](/cascade/functions-and-expressions/functions/logical/if.md) statement Syntax, then you’ll have no problem getting accustomed to writing [IF](/cascade/functions-and-expressions/functions/logical/if.md) statements in Cascade.

Firstly, you need a tool with an Expression Editor in order to write an [IF](/cascade/functions-and-expressions/functions/logical/if.md) statement. Generally speaking, you will use either a [Filter](/cascade/tools/transform/filter.md) tool or an [Edit Columns](/cascade/tools/transform/editcolumns.md) tool; these each have an Expression Editor.

<figure><img src="/files/4a52gv02ApQsNSGMNbei" alt=""><figcaption><p>Configuration window of an <a href="/pages/-MYR3klipPHFAYQUwSqu">Edit Columns</a> tool with an <a href="/pages/-MYYVdWp5hn-zzPxldsW">IF</a> statement</p></figcaption></figure>

Here is the syntax for an [IF](/cascade/functions-and-expressions/functions/logical/if.md) statement in Cascade:

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

The `condition` is a boolean expression to test (e.g., whether or not some statement is true).

The `then` is the true variable.

The `else` is the false variable.

So for example, if I wanted to create an [IF](/cascade/functions-and-expressions/functions/logical/if.md) statement that will append green apples the value ‘*verte’* and red apples the value ‘***rouge***’, my formula might look something like this:

My [IF](/cascade/functions-and-expressions/functions/logical/if.md) statement will look for the value “green” in the `[apple]` column. If the value in the `[apple]` column of a particular row is “green”, then the value ‘***verte’*** would be attributed to that row. If the value is not “green” (e.g., it can be any other value, and we are hoping the only color we might see is red), then the value ‘**rouge**’ would be attributed to that row.

[IF](/cascade/functions-and-expressions/functions/logical/if.md) statements can appear somewhat complex when nesting many conditions and operands. However, there are other [Functions](/cascade/functions-and-expressions/functions.md) available to make writing complex [IF](/cascade/functions-and-expressions/functions/logical/if.md) statements with multiple conditions.

### Related Questions

<details>

<summary>How do I know when to use an IF Statement in Cascade?</summary>

You can use [IF](/cascade/functions-and-expressions/functions/logical/if.md) statements in Cascade when you need to compare values and assign a result based on the outcome of that comparison.

</details>

<details>

<summary>What is the purpose of the IF function?</summary>

The [IF](/cascade/functions-and-expressions/functions/logical/if.md) function is used to test a condition and return one value if the condition is TRUE, and another value if the condition is FALSE.

</details>

<details>

<summary>How many arguments does the IF function require?</summary>

The [IF](/cascade/functions-and-expressions/functions/logical/if.md) function requires three arguments: a condition, a value if the condition is TRUE, and a value if the condition is FALSE.

</details>

<details>

<summary>What is the syntax of the IF function?</summary>

The syntax of the [IF](/cascade/functions-and-expressions/functions/logical/if.md) function is: IF(condition, then, else)

</details>

<details>

<summary>How can I use the IF function to compare multiple values?</summary>

To compare multiple values, you can use the [IF](/cascade/functions-and-expressions/functions/logical/if.md) function in combination with the [AND](/cascade/functions-and-expressions/functions/logical/and.md) or [O](/cascade/functions-and-expressions/functions/logical/or.md)R functions.

</details>

### Other Sources

{% content-ref url="/pages/-MYYVdWp5hn-zzPxldsW" %}
[IF](/cascade/functions-and-expressions/functions/logical/if.md)
{% endcontent-ref %}

{% content-ref url="/pages/eEAIud4Fi4Sdv6MRB4iZ" %}
[IFS](/cascade/functions-and-expressions/functions/logical/ifs.md)
{% endcontent-ref %}

{% content-ref url="/pages/nbq82rUO4BBP0tWnkR42" %}
[IIF](/cascade/functions-and-expressions/functions/logical/iif.md)
{% endcontent-ref %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.cascade.io/cascade/cascade-faqs/functions-and-expressions/how-to-write-an-if-statement-in-cascade.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
