Loop
Loop allows you to repeat the execution of a collection of actions within inner block and also loops through List and Dictionary variables.
Actions
For
This is the same as the for keyword in common programming languages, and settings are as follows:
- Iterator: The options for iteration are:
- Range: Run the same set of actions over and over again by
Iterate times
. - List: Iterates over the specified List variable.
- Dictionary: Iterates over the specified Dictionary variable.
- Range: Run the same set of actions over and over again by
Break
The effect is the same as the break
keyword in common programming languages.
Continue
The effect is the same as the continue
keyword in common programming languages.
Example
1. Create List variable
Create a List variable of subtype String named productList
and set four initial values: UiPath, AA, Zapier, YooginX
.
2. Iterate over the newly created List variables
- Drag and drop action
Loop > For
to the task node list. - Select
List
from the Iterator drop-down box, and then select the variableproductList
you just created. - Select option
All items in the list
. - Finally, create an output variable
currentProduct
of type String to store each data item in the List.
3. Display the contents of each traversal
- Add action
String > Uppercase
to convert each item to uppercase. - Finally, take action Message Box to display the converted result.