Logic Nodes (IF, Switch, Merge)
Branching and decision-making: IF / Switch for conditions, Merge to combine flows, plus No Operation and Wait.
In this chapter
Real-world scenarios are rarely a straight line — 'if X then Y, otherwise Z' decisions show up in every workflow. In this chapter you will learn to bend your workflows with IF (two-way), Switch (multi-way), Merge (combining flows) and Wait (delays).
Topics
- IF node: true/false branching
- Switch node: multi-way routing
- Merge node: strategies for combining flows
- Wait node: delays and timeouts
- No Operation patterns
- Splitting logic with sub-workflows
IF node: two-way branching
IF evaluates a single condition (or several with AND/OR) and splits the workflow into two paths: true (top output) and false (bottom output). In a lead scoring flow the classic use: {{ $json.score >= 70 }} → true assigns to sales, false sends to nurturing. Operators are rich: equals, not equals, contains, starts with, regex match, is empty. One nuance: the 'true' branch carries only matching items and the 'false' branch carries only non-matching ones — so IF doubles as a filter.
Switch node: multi-way routing
When you need more than two branches, Switch is cleaner than chained IFs. In Rules mode each rule creates a separate output (e.g. 'priority = high' → output 1, 'priority = medium' → output 2). In Expression mode the result of an expression picks the output. In a support-ticket flow Switch routes the ticket to the right team (sales/technical/billing) based on {{ $json.category }}. Name the outputs so you remember which is which.
Merge node: combining flows
To bring back a flow that split via IF or Switch (e.g. both branches end with a CRM write), use Merge. Key modes. Append: stacks all items into one list — good for counts. Combine: merges fields of paired items from two nodes (SQL-JOIN-like, by index/key/position). Choose Branch: 'pass through whichever branch arrived' — the most common mode after IF to get back to a single line.
Wait node: delays and timing
Wait pauses a step. Three modes. After Time Interval: 'wait X minutes/hours' — useful for sending a follow-up two days after a welcome email. At Specified Time: wait until a date/time. On Webhook Call: pause until a webhook arrives — ideal for human-in-the-loop flows like 'wait until a manager clicks Approve.'
No Operation: a documentation node
No Operation (NoOp) does nothing — it just sits in the flow. Why does it exist? Two reasons: (1) to visually document 'intentionally do nothing here' in the false branch of an IF; (2) as a workflow comment — name the node 'A daily email will go here later' and leave it as documentation. No performance cost, big readability gain.
Splitting logic with sub-workflows
When a workflow grows past 20-30 nodes, it gets hard to read and maintain. The Execute Workflow node calls another workflow like a function and returns its result. Typical use: extract reusable pieces ('lead-qualifier', 'email-sender', 'crm-sync') into their own workflows and call them from the main flow. You keep repeated logic in one place and tests get easier.
This chapter's workflow (n8n editor view)