1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 17:38:05 +11:00
collapseos/blk/042
Virgil Dupras 4501313410 Add [IF] .. [THEN]
Will be useful as kinds of "#ifdef"s during xcomp.
2020-04-28 08:28:59 -04:00

17 lines
588 B
Plaintext

Flow
Note that flow words can only be used in definitions. In the
INTERPRET loop, they don't have the desired effect because each
word from the input stream is executed immediately. In this
context, branching doesn't work.
f IF A ELSE B THEN: if f is true, execute A, if false, execute
B. ELSE is optional.
[IF] .. [THEN]: Meta-IF. Works outside definitions. No [ELSE].
BEGIN .. f UNTIL: if f is false, branch to BEGIN.
BEGIN .. AGAIN: Always branch to BEGIN.
x y DO .. LOOP: LOOP increments y. if y != x, branch to DO.
(cont.)