(84) :Repeat Condition:Commands:End
(89) :Repeat Condition:Commands:EndRepeat

The Repeat command repeats a group of commands until [Condition] is true.

Unlike While [Condition] which tests the condition as soon as it is passed in the program, Repeat [Conditon] is tested when End is encountered.

Because of this, the instructions inside the Repeat loop are always run at least once.

Repeat can be nested.

If Repeat 0:commands:End is used, the repeat-end block will loop forever, since in boolean 0 equals false

Location Edit

  • PRGM
  • CTL
  • 6:Repeat

Example Edit

:Repeat X=5
:Input "HERE:",X
:Disp "YOU CHOSE 5

This program asks to PLEASE ENTER 5. Once 5 is entered, it will then display YOU CHOSE 5.

Note: Because Repeat tests X=5 once it hits the end there is no need to declare 0→X at the start.

See Also Edit

  • GetKey (examples with Repeat)