# Example of Using a Switch Activity

> To exemplify how to use the **Switch** activity, we are going to create an automation that asks the user for a number, checks if is odd or even, and depending on that, a different message is written to the **Output** panel.

To exemplify how to use the **Switch** activity, we are going to create an automation that asks the user for a number, checks if is odd or even, and depending on that, a different message is written to the **Output** panel.

Since all odd numbers divided by two have a remainder equal to 1, this project needs only two cases (0 and 1), yet keep in mind that this activity supports multiple cases.

1. Create a new sequence.
2. Create an integer variable, `Number`.
3. Add an [Input Dialog](https://docs.uipath.com/activities/docs/input-dialog) activity to the **Designer** panel.
4. Add a **Dialog Title** and **Input Label** to prompt the user for a number.
5. In the **Value entered** field, add the `Number` variable.
6. Add a **Switch** activity, under the **Input Dialog**.
7. In the **Expression** field, type `Number` mod 2. This verifies if the user’s number is divisible by 2.
8. In the **Default** section, add a [Write Line](https://docs.uipath.com/activities/docs/write-line) activity.
9. In the **Text** field, type `Number.ToString` + " is an even number.".
10. Click the **Add new case** line, and in the **Case Value** field, type 1.
11. Add a **Write Line** activity to this case.
12. In the **Text** activity, type `Number.ToString` + " is an odd number.".
    The final project should look as in the following screenshot.

    ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-168397-b9713407.webp)

13. Press F5. The automation is executed. Note that the **Output** panel displays the data correctly.

    ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-170085-87af9ef5.webp)

    ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/studio-docs-image-170089-04e232c5.webp)

[Download example](https://documentationexamplerepo.blob.core.windows.net/examples/Studio_v2022.10/SwitchActivity.zip)
