# Example of Using an If Activity

> To exemplify how you can use the **If** activity, let’s create an automation that asks the user for two numbers, checks to see if one is divisible by the other, and depending on the result, displays a different message in the **Output** panel.

To exemplify how you can use the **If** activity, let’s create an automation that asks the user for two numbers, checks to see if one is divisible by the other, and depending on the result, displays a different message in the **Output** panel.

1. Create a new sequence.
2. Create two integer variables, `FirstNumber` and `SecondNumber` for example.
3. Add two [Input Dialog](https://docs.uipath.com/activities/docs/input-dialog) activities to the **Designer** panel.
4. Type titles and labels for both activities and, in the **Value entered** fields, add the `FirstNumber` and `SecondNumber` variables.
5. Add an **If** activity to the **Designer** panel, under the previously added **Input Dialog** ones.
6. In the **Condition** section, type `FirstNumber` mod `SecondNumber` = 0. This expression checks if the first number is divisible to the second one, using the [mod](https://msdn.microsoft.com/en-us/library/se0w9esz.aspx) operator.
7. In the **Then** section, add a [Write Line](https://docs.uipath.com/activities/docs/write-line) activity.

8. On the right side of the **Text** field, select **Plus** ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/2024-10-docs-image-plus_menu-8a20ac7d.png) &gt; **Open in Advanced Editor**.

9. Inside the **Expression Editor** window, type `FirstNumber.ToString` + " is divisible by "+ `SecondNumber.ToString` + ".". This is the message that is displayed if the first number is divisible by the second one.
10. Click **Show Else** to display the Else section, and then add another **Write Line** activity in the **Else** section.
11. Inside the **Expression Editor** window, type `FirstNumber.ToString` + " is NOT divisible by "+ `SecondNumber.ToString` + ".". This is the message that is displayed if the first number is not divisible with the second one.

    ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/2024-10-docs-image-167057-12239a29.webp)

12. Press F5. The automation is executed.
13. Add numbers when prompted. Note that the **Output** panel displays the result, depending on the values added in the **Input Dialog** windows.

    ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/2024-10-docs-image-166772-7ac2e47f.webp)

    ![docs image](https://dev-assets.cms.uipath.com/assets/images/studio/2024-10-docs-image-168589-d33bb13b.webp)

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