Block reference / Control flow
Loop breakpoint
Mark the end of a loop: go back for the next item, or leave when the loop is done.
In both apps
WarpX Browser
WarpX Phone
Every Loop data and Loop elements block needs a Loop breakpoint with the same Loop ID at the end of its body. Each time the run reaches it, it sends the run back to the loop for the next item. When the items run out or the limit is reached, it ends the loop and leaves by its output. Tick Stop loop on a second breakpoint to leave a loop early.
Settings
- Description
A note shown on the block in the canvas. The log shows the Loop ID for this block.
ExampleEnd of product loop- Loop ID
The Loop ID of the loop this breakpoint closes, typed exactly the same. Spaces are removed.
Exampleproducts- Stop loop
End the loop now, whatever items are left, and leave by the output.
ExampleUnchecked
Every block also has the shared block settings — a description, Disable block and what to do on an error. Fields that take text accept data from earlier blocks.
What it hands on
While items remain, the run goes back to the loop block and this output is not used. When the loop ends, the run leaves by the output once, with the previous block's data, and {{loopData.<Loop ID>}} is cleared.
Example: Close a loop over sheet rows
- Start
- Google Sheets
- Loop data
- New tab
- Get text
- Loop breakpoint
- Google Sheets
- Build the loop: a Google Sheets block with Reference key (optional)
products, then a Loop data block with Loop IDproductslooping through Google Sheets. - Add the steps for one row: a New tab block with
{{loopData.products.url}}, then a Get text block. - Add a Loop breakpoint and set Loop ID to
products. Connect Get text to it. - Connect the breakpoint's output to a Google Sheets block set to Append, which runs once after the last row.
- To stop early, add a Conditions block before the breakpoint, and connect one path to a second Loop breakpoint with Loop ID
productsand Stop loop on.
Good to know
- A Loop ID that does not match a loop that is running fails the block with
Can't find a loop with "products" loop id. This also happens when the run reaches the breakpoint without passing the loop block first. - Every path inside the loop must end at the breakpoint. A Conditions path you leave unconnected ends the run there, and the rest of the items are skipped.
- For Loop elements with a load-more action, the breakpoint is where more elements are loaded: when the current ones run out, it clicks or scrolls, and goes back to the loop if new elements appeared.
- Stop loop does not stop a Loop elements loop that has a load-more action and has not reached its maximum: it loads more first and carries on if it finds any. Set the loop's Action to None if you need to stop it early.
- The limit is the loop block's Max data to loop; for Numbers, it is the range from From number to To number.
See also
- Loop data — Run the blocks after it once for each row, number, list item or element.
- Loop elements — Run the blocks after it once for each element that matches a selector, loading more as it goes.
- Conditions — Send the run down one of several paths, depending on values, page elements or code.