End For Each

Terminates a command block started by the For Each (foreach) command.

Command availability: IBM RPA SaaS and IBM RPA on premises

Dependencies

Start a block of commands with the For Each (foreach) command.

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.

endFor

Example

Loop started by the For Each command displays a message multiple times and End For Each terminates the command block.

defVar --name collection --type List --innertype Numeric --value "[1,2,3,4,5]"
defVar --name iterator --type Numeric
foreach --collection "${collection}" --variable "${iterator}" --distinct
    logMessage --message "Numeric repetition: ${iterator}" --type "Info"
endFor
logMessage --message "End foreach" --type "Info"
// Runs 5 iterations