# Branching

Branching allows your flows to make decisions based on conditions, directing execution along different paths depending on the given input. The **`If`** node is commonly used for this purpose, allowing you to define logic where execution follows one path if a condition is met and another if it is not.

<figure><img src="/files/KjPB7lT5bqhBLiPNVIGv" alt=""><figcaption></figcaption></figure>

1. **Generating a Value:** In the example above, the `Random` node produces a number between `0` and `10`, which is sent to the `If` node.
2. **Evaluating a Condition:** The `If` node checks if the value is greater than `5` using the `predicate` input.
3. **Branching Execution:** If true, execution follows the `then` path; if false, it follows the `else` path.
4. **Logging the Result:** One of the `Log` nodes prints either **“Value is large”** or **“Value is small”** based on the condition.

There are several other branching nodes, wich support various use-cases:

* [**Std Switch**](/midio-docs/built-in-nodes/core-std.md#switch) **- is used to select one of two values based in two potentially incoming paths**
* [**Std OrElse**](/midio-docs/built-in-nodes/core-std.md#orelse) **- is used to select a fallback value when you have a value which can potentially be null.**
* [**Std Match**](/midio-docs/built-in-nodes/core-std.md#match) **- is used to create an arbitrary number of branches based on a list of potential values.**
* [**Std Fork**](/midio-docs/built-in-nodes/core-std.md#fork)**/**[**Std FanOutRange**](/midio-docs/built-in-nodes/core-std.md#fanoutrange)**/**[**Std FanOutList**](/midio-docs/built-in-nodes/core-std.md#fanoutlist) **- these nodes can be used to fork a flow into multiple independenc processes, which execute concurrently and can be joined together again using Std Join and** [**Std JoinAll**](/midio-docs/built-in-nodes/core-std.md#joinall)**.**


---

# Agent Instructions: 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:

```
GET https://docs.midio.com/midio-docs/guides/loops.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
