Scripting with loops
Here, we will explore how to create loops in scripts. You will learn how to build loops and use them.
Getting ready
We just need a working Orchestrator, and you will need the rights to create new workflows and run them. We will work with the Orchestrator Client.
You need to understand how decisions are used in Orchestrator; this was explained in the recipe Scripting with decisions.
For the Foreach element, we will be using the example workflow 00.00 BasicWorkflow
, which is stored in the Basic Helper
folder.
How to do it...
There are several types of loop one can create; however, they can all be reduced to the following two basic types.
The decision loop
This basic kind of loop runs until a certain condition is met. We will build a so-called for
loop in this example. A discussion about the different types of decision loops (for, do-while
, and while-do
) can be found in the How it works... section of this recipe.
- Create a new workflow and build the preceding schema.
- Add the following...