# Flow Switch

Branches in a flowchart based on the value of an expression: the flow moves to the node on the connection of the case the value matches, or to the **Default** branch if it matches none. Used only inside a **Flowchart**.


---

### :arrow_left:**INPUT**

| **Parameter** | **Type** | **Required** | **Description** |
|-----------|------|----------|-------------|
| `Expression` | `T`  | ❌ No     | The expression whose value is compared with the cases. Its type (`T`) is selected in the window that opens when the flow switch is dropped onto the canvas. If left empty, the workflow reports a validation error. |


---

### Usage

* When the flow switch is dropped onto the **Flowchart** canvas, a type is selected for `Expression`.
* The first connection drawn from the flow switch becomes the **Default** branch. Each subsequent connection adds a new case. The case value is assigned automatically as `Case1`, `Case2` … for the string type and `0`, `1` … for integer types; for enum and `Boolean` types an unused value is also selected automatically. For other types, a window asking for the case value opens when the connection is drawn.
* The case value is changed by selecting the connection and editing the `Case` field in the properties panel; the same value cannot be used in two cases. If `IsDefaultCase` is checked, the connection becomes the **Default** branch (there can be only one **Default** branch).
* At run time, `Expression` is evaluated and its value is compared with the case values by exact equality (case-sensitive for strings). The node at the target of the matching case runs. If there is no match, the flow moves to the **Default** branch; if **Default** is not connected, the flowchart completes there.