> For the complete documentation index, see [llms.txt](https://docs.appfarm.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appfarm.io/library/action-nodes/if.md).

# If

Control under which circumstances an Action Node or a set of nodes should be executed. You may add conditions to the `IF` node, and you may add Action Nodes as children of the `IF` node. If the condition is evaluated as `true`, all Action Nodes inside will trigger. You may also add `IF` nodes inside another `IF` node, for more complex evaluation or control of the Action flow.

To handle more than one condition, add **Else if** and **Else** blocks to the same node:

* **Else if**: Only evaluated if the conditions above it (the `IF` block and any earlier **Else if** blocks) evaluate to `false`. If its own condition evaluates to `true`, the Action Nodes inside it run.
* **Else**: A fallback block with no condition of its own. Its Action Nodes run only if none of the conditions above it evaluated to `true`.

Blocks are evaluated from top to bottom, and only the first block whose condition evaluates to `true` runs — the rest are skipped.

### Properties

The `IF` block, and each **Else if** block, requires only a Condition to be set up.

* Data Binding: Select a property (must be a boolean type property) holding TRUE or FALSE. The block will evaluate to TRUE depending on the property you select for Data Binding.
* Condition: Use the [Condition Editor](/reference/platform-concepts/conditions.md) to set up a logical expression. The block will evaluate to TRUE is this expression evaluates to TRUE.
* Function: Use the [Function Editor](/reference/platform-concepts/functions.md) to set up an advanced expression. You may use Javascript inside the Function Editor. The function must return either TRUE or FALSE.

### Add Else if and Else blocks

Hover over the `IF` block, or an existing **Else if** block, to reveal its toolbar. Click **+** and select **Add Else if block** or **Add Else block**.

* You can add any number of **Else if** blocks.
* You can add only one **Else** block. It's always evaluated last, after every **Else if** block.
* Use the up and down arrows in the toolbar to reorder **Else if** blocks and change the order they're evaluated in.

{% hint style="info" %}
**Good to know**

Since blocks are evaluated top to bottom and only the first matching block runs, the order of your **Else if** blocks matters if their conditions overlap.
{% endhint %}


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.appfarm.io/library/action-nodes/if.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
