This is an experimental feature that may change in future versions.
It is provided for compatibility with the Windows version of BBC BASIC and to enhance the code readibility of the Z80 version.
A statement which is the starting point of a WHILE…ENDWHILE loop.
The purpose of a WHILE…ENDWHILE loop is to make BBC BASIC repeat a set number of instructions while some condition is satisfied. The difference between a WHILE…ENDWHILE loop and a REPEAT…UNTIL loop is that the instructions within a REPEAT…UNTIL loop are always executed at least once (the test for completion is performed at the end of the loop) whereas the instructions within a WHILE…ENDWHILE loop are not executed at all if the condition is initially FALSE (the test is performed at the start of the loop).
WHILE LEFT$(A$,1)=" " A$=MID$(A$,2) : REM Remove leading spaces ENDWHILE
You must not exit a WHILE…ENDWHILE loop with a GOTO (see the sub-section on Flow Control for more details). You can force a premature end to the loop with the EXIT WHILE statement.
WHILE…ENDWHILE loops may be nested.
Syntax
- WHILE <t-cond>