Flow Control
HolonJ offers the usual Forth flow control structures.
m n do ... i ... loop
This is equivalent to for( int i = n; i<m; i++) in Java.
The word i is the index of the loop.
p q do ...
m n do ... i ... j ... loop ...
loop
The word j is the index of the outer loop.
m times ... loop
Same as m 0 do .. loop. I use times in loops, where the index is not needed.
m n do ... if ... leave then ... loop
m n do .. if ... else ... leave then ... loop
Execution continues behind loop.
m n do ... if ... return then ... loop
Exits the word, control is returned to the calling word.
begin ... again
Repeats the loop indefinitely.
begin ... if ... return then ... again
Typical use. Returns control to the calling word.
begin ... ( flag -- ) while ... repeats
Repeats the loop as long as the flag is true.
begin ... ( flag -- ) until
Repeats the loop as long as the flag is false.
( flag -- ) if ... then
( flag -- ) if ... else ... then
Continues execution after if, if the flag is true. Otherwise jumps to else.
1998-2013 Wolf Wejgaard