Since version 2.1


while <condition>

The WHILE command starts a pre-test loop where the given condition is evaluated every time before entering the loop. If the condition evaluates to true, the statements between WHILE and ENDWHILE will be executed and the condition will be tested again . If it evaluates to false, the statements will be skipped and execution will be continued after the ENDWHILE statement.

Contrarily to the FOR ... NEXT loop, it is allowed to escape from the WHILE loop using the GOTO command.


print "counting down from ten"
n = 10
while n > 0
  print n
  dec n

Note: for a post-test loop, see REPEAT ... UNTIL.

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies


Enter your comment. Wiki syntax is allowed: