# Switch

Splits the scenario into several branches. Conditions are checked from top to bottom, and the contact follows the first one that fits. If none fits — the "Default" output.

![Settings panel of the "Switch" block](https://support.watbot.org/_media/en/01-chatbots/03-blocks/02-logic/_images/switch-case.webp?v=1791781230)

The block shows nothing to the contact and asks nothing. For a choice the person makes themselves, use buttons in a message block.

## Settings

- **"Add Condition"** — adds a branch. Each branch has one condition.
- **"Condition name"** — the branch's label on the scheme. The contact does not see it.
- **"Edit"** — opens the branch's condition: choose the kind of check in the "Condition" list, fill in the value and click "Save".
- **Order of branches** — drag a branch by its number. The order affects the result: the first branch that fits fires, and the rest are not checked.

The kinds of conditions are the same as in the "Condition" block, except for comparing the message with a number, the date, the time and the Excel spreadsheet. You cannot combine several conditions in one branch.

A new branch has the "Message contains text." condition with empty text. Until the text is filled in, the branch does not fire.

## Outputs

- An output with the condition name — one per branch. It fires for the first branch whose condition is met.
- "Default" — no condition is met.
- "Continue" — always fires, in addition to the output that fired. If "Continue" and a branch are connected to different blocks, the contact gets both.

## Good to know

- A branch with a tag condition where no tag is chosen fits everyone. Contacts will follow it, and the branches below will never get their turn.
- If the branch that fits has no connection to a next block, the "Default" output does not fire: the contact goes nowhere along the branches.

Example: the `city` variable holds the contact's answer. The "London", "Leeds" and "Bath" branches with the "Variable matches the set expression" condition lead to their own shop addresses, and "Default" leads to a message about delivery.
