Begin Do-While
Starts a repetition structure that runs a block of code until a condition is met.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
The command starts a repetition structure that runs a block of code until a condition is met. It differs from the For (for
) and While commands because
the sequence of commands are run before evaluating the expression.
The name of the command refers to a common repetition structure in some programming languages called do-while
.
Dependencies
The End Do-While (until
) command defines the conditions that are evaluated to run the repetition structure.
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
repeat
Example
The following example increments the value of the variable by one during the loop. It prints the result of the after the loop is done.
defVar --name incrementedVariable --type Numeric
repeat
logMessage --message "${incrementedVariable}" --type "Info"
incrementVar --number ${incrementedVariable}
until --left "${incrementedVariable}" --operator "Less_Than" --right 10
logMessage --message "Final result ${incrementedVariable}" --type "Info"