---
version: "2026.1.0"
language: "en"
---
# Switch

The **Switch** block routes your automation based on an Input value. It checks the input against multiple cases and continues through the first case that matches, using the selected Comparison method and Comparison type. If no cases match, the flow continues through No match (default).

Fully expanded, the **Switch** block shows the following properties:  
![image-20251222-135741.png](https://docs.leapwork.com/__attachments/a_7e48356487940db84169898ad2df9d94889e7195f99522adaba63abeafb9308e/image-20251222-135741.png?cb=c24b4e142d750b6e901ea2d4f619d4be)

**Note:** The screenshot on this page uses the **Elegance Design** , introduced in **2025.3**. If you are using an earlier version, your layout may look different.

## Quick-start

1. Drag **Switch** onto the canvas.

2. Connect the block in the flow and optionally specify the basic parameters required for this block to operate, listed by their exact UI labels in one line: **Input** , **Add case** , **Comparison method** , **Comparison type**.

3. Run the flow when it's ready.

## Building block parameters

Parameters  
* **Block header:** Shows the current name of the **Compare** block. You can rename it by double-clicking the header and typing a new title.

* **Value A:** Specifies the first value used in the comparison. This can be typed directly in the field or provided from another block through an input connection.

* **Value B:** Specifies the second value used in the comparison. This can be typed directly in the field or provided from another block through an input connection.

* **Incorrect:** Triggers when the comparison evaluates to false. For example, if **Value A** is `100`, **Value B** is `200`, and **Comparison method** is **Greater than** , then **Incorrect** triggers.

* **Comparison method:** Defines how **Value A** and **Value B** are compared. Available options are:

  * Equal

  * Not equal

  * Greater than

  * Greater than or equal

  * Less than

  * Less than or equal.

* **Comparison type:** Selects which data type is used for the comparison. Values are automatically converted to appropriate data types, but in some cases it makes sense to choose the type explicitly. Choosing the wrong comparison type can have unforeseen consequences.

  For example, comparing the text `200,200` with the position `200,50` results in false, but comparing the position `200,200` with the position `200,50` results in true.

  The dropdown includes the following options:

  * As Input Value: Uses the type of Input.

  * Area

  * Boolean

  * Date

  * DateTime

  * Number

  * Position

  * SapElement

  * Signal

  * Text

  * TextBuilder

  * Time

  * TextBase

## Let's understand this using an example:

**Scenario**: Routing Actions Based on Text Value

The Set Text block sets the text value to "Completed." This value is sent into the Switch block as Input. The Switch block checks what the value is:  
![image-20251222-140405.png](https://docs.leapwork.com/__attachments/a_522f3b8f8962552d2e7f6fe9aea64f6ed1f43c7c555a865587856f14e0f168e7/image-20251222-140405.png?cb=d6ec961ef8e6a939d8184aaaf79ffbac)

* If it is **Completed** → Case 1 will be executed, leading to run **Pass** block.

* If it is **Not started** → Case 2 will be executed, leading to run **Fail** block.

* If it is **Initiated** → Case 3 will be executed, leading to run **Done** block.

* If it is anything else → the flow will go to **Close Windows**, which means all current windows will be closed.

Since the value is **Completed** , the flow always goes to the **Pass** block.

## Resources

|                                                **Topic**                                                |                                                  **Description**                                                  |
|---------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------|
| [Flows FAQ](https://docs.leapwork.com/faq/latest/leapwork-flow-faq/flows-faq.md)                                                 | Common questions about creating, running, and managing flows in Leapwork.                                         |
| [Flows Troubleshooting](https://docs.leapwork.com/troubleshooting/latest/leapwork-flow-troubleshooting/flows-troubleshooting.md) | Guidelines and solutions for identifying and fixing issues that occur when building or running flows in Leapwork. |