> ## Documentation Index
> Fetch the complete documentation index at: https://docs.assistable.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Route a flow with conditions

> Choose a connected path from known variable values and provide a fallback.

Use a **Logic** node after the information needed for a decision is already available. For example, route a lead to the next step only when an email address has been collected.

## Create the decision

1. Add a Logic node after the step that sets or extracts your variables.
2. Add a branch and choose the variable, comparison, and expected value.
3. Choose **AND** when every condition must match, or **OR** when any condition is sufficient.
4. Connect the branch handle to its destination.
5. Connect the default path to a recovery step, such as asking for the missing information.

Branches are evaluated in their listed order. The first matching branch wins, so put a more specific condition before a broad one.

## Example: collect an email before continuing

| Branch | Condition | Destination |
| - | - | - |
| Email available | `caller_email` is not empty | Confirm the address, then continue |
| Default | No matching branch | Ask for the email address |

“Not empty” checks presence, not whether an address is valid or deliverable. Use validation appropriate to the external system before relying on the value.

## Comparison behavior

Text equality, contains, starts-with and ends-with comparisons ignore letter case. Empty checks trim whitespace. Greater-than and less-than comparisons parse numbers; do not use them to compare dates or arbitrary formatted text. A missing variable is treated as empty.

## Test the branches

Run the flow with a matching value, a nonmatching value, and no value. Also test a value that could match more than one branch to confirm the order is intentional.

If the conversation stops at Logic, check for an unwired matching branch or a missing default. Without a usable destination, the runtime can stop that turn and reconsider the node on the next turn.

See [extracting values](/v3/guides/flows/collect-values) and [testing](/v3/guides/flows/test).

## All comparisons and branch options

| Comparison in the editor | Meaning | Example |
| - | - | - |
| is set | Value has non-whitespace text. | `caller_email` is set |
| is empty | Missing, empty, or whitespace-only value. | `caller_email` is empty |
| equals | Case-insensitive equality; does not trim both values. | `status` equals `qualified` |
| does not equal | Case-insensitive inequality. | `status` does not equal `closed` |
| contains | Case-insensitive substring. | `services` contains `repair` |
| does not contain | Substring is absent. | `services` does not contain `repair` |
| greater than | Parses both values as numbers, then compares. | `quantity` greater than `2` |
| less than | Parses both values as numbers, then compares. | `quantity` less than `10` |
| starts with | Case-insensitive prefix. | `reference` starts with `INV-` |
| ends with | Case-insensitive suffix. | `reference` ends with `-US` |

Each branch has a label, one or more conditions, and **AND** or **OR**. AND requires all conditions; OR requires any one. Empty branches are skipped. The first matching branch wins. The default destination runs only when no branch matches, so an unwired matching branch is not rescued by a wired default.

The variable field accepts `caller_email` or `{{caller_email}}`. The expected value can be literal text or another existing variable name (with or without braces). If a literal happens to match a stored variable name, that variable's value is used. Numeric comparisons use numeric-prefix parsing: `12 items` can be read as 12, and an unparseable value does not satisfy greater/less. Validate the whole value separately when its format matters.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.