> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oration.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Switch

> Multi-way branch based on a variable's value

The **Switch** node evaluates a variable against multiple cases and routes the flow to the matching branch. It works like a `switch/case` statement — if no case matches, the flow takes the `Default` path.

## Behavior

* Reads the specified variable's value
* Compares against each case using the configured match type
* Routes to the first matching case, or `Default` if none match
* Output handles are **dynamic** — one handle per case plus a `Default` handle

## Configuration

| Parameter       | Type      | Default   | Options                      | Description                                                                 |
| --------------- | --------- | --------- | ---------------------------- | --------------------------------------------------------------------------- |
| `variable`      | string    | `""`      | —                            | Variable name to evaluate                                                   |
| `matchType`     | enum      | `"exact"` | `exact`, `contains`, `regex` | How to compare variable value against cases                                 |
| `caseSensitive` | boolean   | `false`   | —                            | Enable case-sensitive matching                                              |
| `cases`         | string\[] | `[]`      | —                            | List of case values to match against. Each case generates an output handle. |

### Match types

| Type       | Description                                               |
| ---------- | --------------------------------------------------------- |
| `exact`    | Variable value must exactly equal the case value          |
| `contains` | Variable value must contain the case value as a substring |
| `regex`    | Case value is treated as a regular expression pattern     |

## Output handles

Switch output handles are dynamic — each case generates a handle, plus a `Default` handle for the fallback:

| Handle            | Description                                                |
| ----------------- | ---------------------------------------------------------- |
| **\[Case Value]** | Flow follows this path when the variable matches this case |
| **Default**       | Flow follows this path when no case matches                |

## Use cases

<AccordionGroup>
  <Accordion title="Language routing">
    Switch on `{{language}}` with cases `en`, `es`, `fr`, and a `Default` fallback. Route each to a language-specific TTS greeting.
  </Accordion>

  <Accordion title="Department selection">
    After an IVR Menu collects a department name via speech input, switch on the transcript to route to Sales, Support, or Billing queues.
  </Accordion>

  <Accordion title="API response routing">
    After an API Call, switch on `{{status_code}}` with cases `200`, `404`, `500` to handle different response scenarios.
  </Accordion>
</AccordionGroup>
