Course/Chapter 4/3. Logic & Flow Control
    beginner
    Chapter 4: n8n Nodes Deep Dive

    3. Logic & Flow Control

    Master branching, merging, and batch processing.

    20m Lesson 3 of 6

    Logic nodes control how data flows through your workflow. They enable conditional execution, parallel processing, and data combination.

    Key Logic Nodes

    • - IF: Route items to "true" or "false" branches based on a condition
    • - Switch: Route items to multiple branches based on value matching
    • - Merge: Combine data from two or more branches
    • - Split In Batches: Process large datasets in smaller chunks
    • - Wait: Pause execution for a set time or until a webhook is received

    Code Examples

    IF Node — Common Conditions
    javascript
    // String equals
    {{ $json.status }} equals "active"
    
    // Number greater than
    {{ $json.amount }} is greater than 100
    
    // Contains
    {{ $json.email }} contains "@company.com"
    
    // Exists
    {{ $json.phone }} exists
    
    // Regex match
    {{ $json.code }} matches regex ^[A-Z]{3}-\d{4}$

    Pro Tips

    • 💡The Merge node has 3 modes: Append, Keep Key Matches, and Multiplex — choose based on your data combination needs

    Comprehension Quiz

    Answer 2 of 2 correctly to unlock lesson completion.

    1. What does the IF node do?

    2. What is the Split In Batches node used for?

    Pass the quiz above to unlock lesson completion