Artisan SVG > Break Loop (break-loop) (arrow-return)
Artisan SVG > Break Loop (break-loop) (arrow-return)

Break loop
1.1

Break a loop when certain conditions are met with the Break loop core connector

Overview
Copy

The Break Loop connector is always used in conjunction with the Loop connector.

IMPORTANT!: The break loop connector is often used in conjunction with the 'loop forever'operation which is risky to use. Please see the Loop connector documentation for instructions on making sure this doesn't actually loop forever!

It is a vital tool which enables you to break a loop when certain conditions are met.

Example - breaking a loop when the last customer has been processed
Copy

For example you might be looping through a list of customers and each time you need to make a boolean check to see if you have just processed the last customer. If so then the loop should be broken so that your workflow can continue on to the next stage.

The following workflow gives a very simplified version of this (with any of the actual data processing actions stripped out):

The boolean More customers? step makes use of the fact that, for each customer, Stripe returns a has_more value.

A more detailed look into this can be found in the Updating missing customer info tutorial in our section on pagination techniques.