> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/build/flow-logic.md).

# Flow logic

How to represent logic in n8n workflows.

n8n allows you to represent complex logic in your workflows.

## In this section <a href="#in-this-section" id="in-this-section"></a>

* [Split with conditionals](/build/flow-logic/split-with-conditionals.md): route items down different branches with the IF and Switch nodes.
* [Merge data](/build/flow-logic/merge-data.md): combine multiple data streams back into one.
* [Loop](/build/flow-logic/loop.md): repeat an action until a condition is met, or until all items are processed.
* [Wait](/build/flow-logic/wait.md): pause a workflow's execution and resume it later.
* [Understand execution order](/build/flow-logic/understand-execution-order.md): learn how n8n decides which branch runs first in a multi-branch workflow.
* [Break workflows into smaller parts](/build/flow-logic/break-workflows-into-smaller-parts.md): call one workflow from another to build modular, microservice-like workflows.
* [Convert to sub-workflows](/build/flow-logic/convert-to-sub-workflows.md): turn part of an existing workflow into a reusable sub-workflow.
* [Handle errors gracefully](/build/flow-logic/handle-errors-gracefully.md): set up an error workflow to respond to execution failures.

## Related sections <a href="#related-sections" id="related-sections"></a>

You need some understanding of [Data](/build/work-with-data.md) in n8n, including [Data structure](/build/work-with-data/understand-n8ns-data-structure.md) and [Data flow within nodes](/build/work-with-data/understand-n8ns-data-structure.md#how-data-flows-within-nodes).

When building your logic, you'll use n8n's [Core nodes](/integrations/builtin/core-nodes.md), including:

* Splitting: [IF](/integrations/builtin/core-nodes/n8n-nodes-base.if.md) and [Switch](/integrations/builtin/core-nodes/n8n-nodes-base.switch.md).
* Merging: [Merge](/integrations/builtin/core-nodes/n8n-nodes-base.merge.md), [Compare Datasets](/integrations/builtin/core-nodes/n8n-nodes-base.comparedatasets.md), and [Code](/integrations/builtin/core-nodes/n8n-nodes-base.code.md).
* Looping: [IF](/integrations/builtin/core-nodes/n8n-nodes-base.if.md) and [Loop Over Items](/integrations/builtin/core-nodes/n8n-nodes-base.splitinbatches.md).
* Waiting: [Wait](/integrations/builtin/core-nodes/n8n-nodes-base.wait.md).
* Creating sub-workflows: [Execute Workflow](/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflow.md) and [Execute Workflow Trigger](/integrations/builtin/core-nodes/n8n-nodes-base.executeworkflowtrigger.md).
* Error handling: [Stop And Error](/integrations/builtin/core-nodes/n8n-nodes-base.stopanderror.md) and [Error Trigger](/integrations/builtin/core-nodes/n8n-nodes-base.errortrigger.md).

## Related resources

* [Build](/build/readme.md)
* [Understand workflows](/build/understand-workflows.md)
* [Build and manage agents](/build/build-and-manage-agents.md)
* [Ways of building workflows](/build/ways-of-building-workflows.md)
* [Manage workflows](/build/manage-workflows.md)
* [Work with data](/build/work-with-data.md)
* [Code in n8n](/build/code-in-n8n.md)
* [Integrate AI](/build/integrate-ai.md)
* [Keyboard shortcuts](/build/keyboard-shortcuts.md)
