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 WHILEENDWHILE loop.

The purpose of a WHILEENDWHILE loop is to make BBC BASIC repeat a set number of instructions while some condition is satisfied. The difference between a WHILEENDWHILE loop and a REPEATUNTIL loop is that the instructions within a REPEATUNTIL loop are always executed at least once (the test for completion is performed at the end of the loop) whereas the instructions within a WHILEENDWHILE 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

You must not exit a WHILEENDWHILE 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.

WHILEENDWHILE loops may be nested.


Associated Keywords