Subscribe

UiPath Studio

The UiPath Studio Guide

Number Variables

Number variables are also known as integer or Int32, and are used to store numeric information. They can be used to perform equations or comparisons, pass important data, and many others.

Example of Using a Number Variable

To exemplify how you can work with number variables, we are going to create an automation that asks the user for the year in which he or she was born and displays the age in a window.

  1. Create a new sequence.
  2. Create two Int32 variables, BirthYear and Age. The first stores the user’s birth year and the second, the user’s age.
  3. Add an Input Dialog activity to the sequence.
  4. In the Dialog Title and Input Label fields, type an appropriate title and label.
  5. In the Value entered field, add the BirthYear variable.
  6. Add an Assign activity under the Input Dialog.
  7. In the Properties panel, in the To field, add the Age variable.
  8. In the Value field, type 2022 – BirthYear. This assigns the value of the subtraction (2022 minus the user’s birth year) to the Age variable.
  9. Add a Message Box activity under the Assign one.
  10. In the Properties panel, in the Text field, type "Congratulations! You are " + Age.ToString + ".".

📘

Note:

The .ToString method converts the integer stored in the Age variable to a string and displays it as such.

The final project should look as in the following screenshot.

335
  1. Press F5. The automation is executed. Note that the Message Box displays your age, as expected.
244

Download example

Updated 3 months ago


Number Variables


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.