How to Stop Repeat / break out of the loop?

Intentionally crash the script when you want to break out of the repeat. Encapsulate the repeat within a Try/Catch so you can recover from the crash. In this example, it’ll crash on the first iteration after setting the variable “out”, so only one “out” will be defined

Obviously, the Wappler team needs to build a proper “Break” step instead of relying on this workaround I just came up with. Hope it helps meanwhile :slight_smile:

The rest of your script goes outside the Try/Catch - only use the Try/Catch for the repeat. You don’t need a Catch, the Catch is just there for debugging purposes

Feature request has been opened, vote for it:
https://community.wappler.io/t/break-step-to-break-out-of-while-or-repeat-loops/41909/2