Skip to contentSkip to Content
Commands libraryLOOP & BREAK

Mantis LOOP, BREAK & CONTINUE Commands

The LOOP command repeats a block of instructions a fixed number of times or infinitely until terminated by BREAK.


Syntax & Examples

Finite Loop

hello.mantis
1REM Type 5 dots with 300ms delays
2LOOP 5
3 STRING .
4 DELAY 300
5END_LOOP

Infinite Loop with Button BREAK

hello.mantis
1LOOP
2 LED_ON
3 DELAY 100
4 LED_OFF
5 DELAY 100
6
7 IF BUTTON_PRESSED THEN
8 BREAK
9 END_IF
10END_LOOP

  • IF / ELSE — Conditional branching inside loops.
  • FUNCTION — Reusable subroutines.
Last updated on