Loops
Learn how to repeat actions using loops
While loop
A WHILE loop runs as long as the condition is true.
X = 0 WHILE X < 5 PRINT X X = X + 1 END
Sum from 1 to N
Calculate a running total and watch it change in the debugger.
N = 5 SUM = 0 X = 1 WHILE X <= N SUM = SUM + X X = X + 1 END PRINT SUM
Countdown
Loop backwards from a number to zero.
X = 5 WHILE X >= 0 PRINT X X = X - 1 END
Loop with input
Ask the user for input multiple times.
X = 0 WHILE X < 3 INPUT A PRINT A X = X + 1 END