Updated: May 13, 2022
In UiPath any variable must have a data type that will identify what kind of value will be stored in each variable or argument. Once the variable is declared, it is not possible to change its type within the same scope.
UiPath has a wide list of data types to be used that varies from simple values such as Strings, Numbers, and Booleans, to complex structures such as Lists of Email messages. You can find the full list of variable types in the following link.
Variables are containers that can store multiple values of the same data type. In UiPath, variables are similar to the variables in any other programming knowledge. However, the way you will declare, assign, and update may be a lit different. UiPath is a low-code and drag-and-drop tool and you don't need to import namespaces or libraries to use its variables (at least not explicitly), but you do have to do some work to use most of them.
The Variables panel is where all the variables will be declared inside of each workflow. The scope of them will vary depending on each activity, but you might change them as per your need. In the below example, the variable str_Message is declared as a string and its scope is the sequence called Main.
Whenever you need a data type that is not listed in the drop-down menu, you can always Browse for types. That will open a wider variety of types to choose from. In this example, I've searched for a MailMessage data type.
The main properties of a variable in UiPath are.
Name: Unique name that helps to identify what is the purpose of the variable.
Type: Defines what is the type of value to be stored by the variable
Default Value: Used to set an initial value for the variable if needed. However, it's not required.
Scope: It defines where the variable can be used. It might be global within the workflow, or local which means it is available only inside specific activities.
Different data types will enable a whole set of properties and functions that will vary from data type to data type.
In a nutshell, arguments are very similar to variables. They will store data, have the same data types, and support the same methods and properties. However, an argument is used to pass values from one place to another, usually workflows. Arguments have to have at least one direction In, Out, or both In/Out. The arguments will behave differently for each one of them.
Elaborating a bit on the previous example, we can create a new workflow that has an input parameter for the message as shown below.