Skip to content

Gloop Break Icon

Break

Break Steps in Gloop are a hybrid of the Java break and return keywords. Break Steps let you choose where in the Gloop Service you would like to break from. Break Steps use the Expression property to determine where to break from. Some default choices for the expression are:

  • $gloopParent - this will break from the parent of the Break Step
  • $gloopIterate - this will traverse up the execution stack of the current Gloop Service until it finds a parent Iterate Step and break out of it
  • $gloopWhile - this will traverse up the execution stack of the current Gloop service until it finds a parent While Step and break out of it
  • $gloopService - this will return from the Gloop Service that contains the Break Step
  • $gloopAll - unlike $gloopService, this will break from the entire execution stack, basically halting the Gloop service altogether

If Evaluate is false and the value of Expression is anything but the values above, the Break Step will traverse through its parents (in the current Gloop Service) and break from the parent whose Label equals the expression.

If Evaluate is true, Gloop will run the expression and use the result from it to perform the logic above.

In the example Gloop Service below, the following will happen when certain values are encoutered in the array myArray:

Value Action
hello Break from the Fork step at line 3 and then continue at line 9
world Break from the Block step at line 2 (since the Label matches) and then continue at line 10
milkyWay Break from the Iterate step at line 1 and then continue at line 11
galaxy Return from service altogether, and continue with the service that called this service (if any)
universe Gloop will halt execution of the service and any parent services altogether (similar to a System.exit(0), but only for the service)

Example service with Break Step in Coder Studio

Example service with Break Step in Coder Cloud

Break expression auto-complete

If you click on the Expression property in the Properties view in Coder, a drop-down will appear with the valid options for the Break Step, including parent steps that have labels.

[start-toggler] Gloop Break Expression in Coder Studio ![[Coder Studio]] Gloop Break Expression in Coder Cloud ![[Coder Cloud]] [end-toggler]

If you enter an invalid expression for the Break Step, an error will appear in Coder Cloud:

Gloop Break Step with error