WHILE


Language statement WHILE


10
20  WHILE expr
30
Loop while a test condition evaluates to true.


See examples


If there is insufficient information on this page and you wish learn more about WHILE, please send an email to smallbasic@gmail.com. You can help to improve information about WHILE by submitting an article using the comments link below. Note, an offline language reference text file is now avialable – see the Download section.

SmallBasic starts by evaluating expression. If expression is nonzero (true), the next command is executed. If expression is zero (false), control passes to the first command following the next WEND command.

When SmallBasic encounters the WEND command, it reevaluates the expression parameter to the most recent WHILE. If that parameter is still nonzero (true), the process is repeated; otherwise, execution continues at the next command.

WHILE/WEND loops may be nested to any level of complexity, but there must be a WEND for each WHILE.

C=1
WHILE C<10
    PRINT C
    C=C+1
WEND
...
' This is the same with that
FOR C=1 TO 9
    PRINT C
NEXT