BEGIN UNTIL BEGIN AGAIN BEGIN WHILE REPEAT
BEGIN..UNTIL
In a BEGIN..UNTIL
loop, the definition part located between
these two words are repeated as long as the previous test result UNTIL
delivers a false Boolean flag. Example:
: DACTYLO ( --) BEGIN KEY DUP EMIT ASCII $ = UNTIL ;
Running DACTYLO
displays all characters typed on the keyboard.
Only pressing the key marked with '$' can interrupt the repetition.
BEGIN..AGAIN
The use of AGAIN
equals BEGIN ... 0 UNTIL
.
BEGIN..WHILE..REPEAT
In this structure, the test runs before WHILE
. If the result
is false, execution continues after REPEAT
. If the result is true,
the definition part between WHILE
and REPEAT
is executed,
then REPEAT
performs an unconditional backward connection, ie
returns execution to BEGIN
.