---
title: "Switch"
description: "Local-first visual environment for building and running AI workflows. Build agents visually, deploy anywhere, privacy by design."
canonical: https://docs.nodetool.ai/nodes/nodetool/control/switch
markdown: https://docs.nodetool.ai/nodes/nodetool/control/switch.md
product: NodeTool
source: https://github.com/nodetool-ai/nodetool/blob/main/docs/nodes/nodetool/control/switch.md
---

# Switch

**Type:** `nodetool.control.Switch`

**Namespace:** `nodetool.control`

## Description

Multi-branch routing: match a value against cases and route to the matching output.
    control, switch, match, case, branch, route, multi-branch, flow-control

    Use cases:
    - Route data based on string/number matching
    - Implement multi-way branching logic
    - Replace chains of If nodes

## Properties

| Property | Type | Description | Default |
|----------|------|-------------|---------|
| value | `any` | The value to match against cases. | `` |
| cases | `list[any]` | List of values to match against. The first match wins. | `[]` |
| input | `any` | The data to route to the matched output. | null |

## Outputs

| Output | Type | Description |
|--------|------|-------------|
| matched | `any` |  |
| default | `any` |  |
| index | `int` |  |

## Related Nodes

Browse other nodes in the [nodetool.control](./) namespace.
