TI-Basic Z80 Programming/List of Commands/Repeat

The syntax for the "Repeat" command is as follows: Repeat condition. The program executes the command between Repeat and End until the condition is true. The condition is tested when End is encountered, therefore, the commands are always executed at least once. The Repeat command is similar to the While command except that the While command executes while condition is true and tests when While is encountered. Following are examples showing the differences in output of similar Repeat and While commands:

Repeat Program

:0→x
:Repeat X=1
:Disp X
:X+1→X
:End

The output of this program is the single character 0.

While Program

:0→x
:While X≤1
:Disp X
:X+1→X
:End

The output of this program is the characters 0 and 1.