If / Else
Send the run down one of up to five branches, by testing a condition on each.
The If / Else node (if_else) tests its branches' conditions in order and continues the run down the first one that holds, or down its Else branch when none does. Every other branch, and everything only it leads to, shows as skipped in the run trace.
Configuration
| Field | Type | Default | Description |
|---|---|---|---|
branches | list of { id, label, expression }, up to 5 | [] | The conditions, tested top to bottom. id is the branch's output handle; label is what the canvas shows. |
defaultBranchId | string | default | The handle taken when no condition holds — the Else branch. |
Writing a condition
A condition is a {{ }} expression with at most one comparison in it:
| Operator | Meaning |
|---|---|
==, != | Equal / not equal. Numbers written as text compare as numbers: '85' == 85 holds. |
===, !== | Strictly equal / not equal: type and value. '85' === 85 does not hold. |
>, >=, <, <= | Ordered comparison — numerically when both sides are numbers, otherwise alphabetically. |
For example {{ upstream.score.output.value }} >= 50, {{ trigger.body.country }} == DE, or {{ upstream.review.output.response.approved }} == yes. Quote a value that contains spaces or operator characters: {{ trigger.body.status }} == "on hold".
A condition with no operator is tested for truthiness: true, a non-zero number, any non-empty text other than false, or any object or list holds; false, 0, empty text, null and a missing value do not. A condition that is exactly one {{ }} reference to a true/false value — a Classify node's discarded, say — is used as it is.
There are no and/or connectives, function calls or arithmetic, by design. To test two things, chain two If / Else nodes, or compute the value first with an AI Prompt or Edit Fields node.
Output
| Field | Type | Description |
|---|---|---|
branchTaken | string | The id of the branch the run took, or defaultBranchId. |
Limits and errors
- At most 5 branches besides Else.
- A condition the node cannot parse — two comparisons, or an empty side — fails the node, naming the condition. It is never quietly treated as false.
- A
{{ }}reference that cannot be resolved fails the node the same way it fails any other.
Example
name: Route by amount
description: Sends large orders for approval.
graph:
nodes:
- id: order
type: trigger_http
position: { x: 0, y: 0 }
data:
method: POST
fields:
- { name: total, type: number, required: true }
- id: check-total
type: if_else
position: { x: 280, y: 0 }
data:
branches:
- { id: large, label: Over 10 000, expression: '{{ trigger.body.total }} > 10000' }
defaultBranchId: default
- id: approve
type: human_review
position: { x: 560, y: -80 }
data:
title: Large order
message: 'An order of {{ trigger.body.total }} needs approval.'
responseFields:
- { name: approved, type: yes_no }
timeoutValue: 24
timeoutUnit: hours
approverRequired: true
- id: accept
type: variable
position: { x: 560, y: 80 }
data: { name: status, type: string, initialValue: accepted }
edges:
- { id: order-to-check, source: order, target: check-total }
- { id: large-to-approve, source: check-total, target: approve, sourceHandle: large }
- { id: else-to-accept, source: check-total, target: accept, sourceHandle: default }In a Package
- Travels:
branches,defaultBranchId - Converted: none
- Never carried: none