Browse the docs

Break out of repeat

Leaves the innermost Repeat loop and carries on after it.

Break out of the loop

Keyboard Maestro: BreakFromLoop

Details #

Stops the surrounding Repeat loop right away. The macro continues with the step after the loop. If loops are nested, only the innermost one ends.

It works through If and Group, so put it in a then list behind a condition.

Stop at the first match
Do
  1. Set names to “Ada”, “Grace”, “Linus”
  2. Repeat for each name in names
  3. If name is “Grace”
  4. Break out of the repeat
  5. Show “Stopped at {{ name }}”
Open in Switchboard to try it

Parameters #

This step takes no parameters.

Examples #

Give up after three tries
Do
  1. Repeat 10 times
  2. If try is at least 3
  3. Break out of the repeat
Open in Switchboard to try it

Gotchas #

See also #

Next repeat, Repeat, Stop macro