Break Iteration

The Break iteration building block is used to break out of loops or iterations and trigger the “Completed” property of the building block that is performing the iteration.Fully expanded, the Break iteration block shows the following properties:

break iteration building block

The Block Header (“Break iteration”)

The green input connector in the header is used to trigger the block to start executing, breaking iteration.

The title of the block (“Break iteration”) can be changed by double-clicking on it and typing in a new title.

Scope

The Break iteration block can either break out of the current iteration or break out of all nested iterations. The latter can be handy for instance in situations where nested loops or iterations are used to compare a combination of values with on-screen content.

Example

The following is an example of reading a number from the screen, comparing with a value from a loop block. If a match is found, the value is stored in a permanent variable for later use and the Break iteration block is used to break out of the loop:

break iteration example

Updated February 6th 2018.