Checks the defined condition at the beginning of this activity and creates a loop that executes an activity inside the body while that condition is met.
Condition - The condition required in order for the activity/activities to be executed.
DisplayName - Renames the activity.
- Name the initial Sequence as Main Sequence.
- Add a While activity inside the Workflow area.
- In the Body, add a Sequence activity.
- Create an Integer variable, num, with the Main Sequence as its Scope. On the Default field, write 1.
- Create another Integer variable, ctr, still having Main Sequence as its Scope. On the Default field, type 1.
- Add a Write Line activity inside the While activity's Sequence.
- In the Write Line Text field, write num.ToString. This displays the value of the num variable when executed.
- Add an Assign activity.
- In the Assign To field, write num, and in the Assign Value field, write num + 1. This increments the value of num variable by one.
- Add another Assign activity.
- In the Assign To field, write ctr, and in the Assign Value field, write ctr + 1. This would also increase the value of the ctr variable by one.
- In the Condition field of the While loop activity, write ctr < 5. This means the sequence of activities inside the Body will continuously execute until the value of ctr, that serves as the counter, reaches 5.
The use case should look like the following screenshot:
The output should look like this in the Output panel:
Expected results to be shown on the Output panel