Interrupt Loop
Interrupts a repetition structure from running further.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
This command interrupts an iteration and breaks the loop that is currently running. Commands that come after inside the repetition structure block are ignored.
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.
break
Dependencies
You must use this command inside a repetition structure block. The following commands start a repetition structure:
- For (
for
) - While (
while
) - Begin Do-While (
repeat
) - For Each (
foreach
)
Example
The following example demonstrates how to interrupt the repetition structure after one iteration.
defVar --name counter --type Numeric
for --variable ${counter} --from 1 --to 5 --step 1
logMessage --message "${counter}" --type "Info"
break
next
logMessage --message "End for" --type "Info"