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

# Switch

**Specify variables and execute respective set of actions.**

<img src="https://mintcdn.com/organa/IAAgt4Qjpzo5KMmv/images/switch-flow-control-header.webp?fit=max&auto=format&n=IAAgt4Qjpzo5KMmv&q=85&s=28696482480a0caf84ca0bf2497f683d" alt="switch-flow-control-header" width="2430" height="1356" data-path="images/switch-flow-control-header.webp" />

The Switch block allows you to specify a value or variable and then define a set of cases that will be executed based on the value of that variable. This block is useful for creating workflows that respond to specific values or inputs and take different actions based on those inputs.

It uzilizes the same condition syntax as the [If Conditions](/actions/flow-control/if#condition-syntax).

## Example

<iframe style={{overflow: "hidden", borderRadius: "6px"}} width="100%" height="500px" src="https://app.fastgen.com/demo/switch" />

In the example above we're checking for which `state` has been received by the endpoint. If we receive `CA` or `NY`, we send unique response messages. If we receive any other state, the default path will be triggered.

If several conditions are met, only the first one in sequence will be executed.
