System.Activities.Statements.DoWhile
- Do While activity is used to execute a specified part of automation while a condition is met. When the specified condition is no longer met, the project exits the loop.
- This activity is used to browse through array indices or step through a list of items by incrementing counters.
Properties
Misc
- Condition (Activity<Boolean>) – Define a condition/an expression.
- DisplayName (String) – To set a meaningful name according to the user.
Example
To use a Do While activity, create an automation that increments an integer variable 0 to 10, and displays a message every time it is incremented.
- Create a sequence.
- Create an integer variable, counter, with the default value of 0.
- Add a Do While
- Add an Assign activity in the Body section of the Do While
- Add the counter variable in the Properties panel, in the To field of the Assign
- Type counter + 1 in the Value field, which increments the value of the counter with one.
- Add a MessageBox activity under the Assign
- Type “The counter value is”+Tostring+”.” which displays the value of counter in the screen each time it is incremented.
- In the Condition field, type counter < 10. This condition means the body of the loop will be repeated until the value of the counter variable is going to be bigger than 10.