<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>
In Flow Control Words in TurboForth Kernal
In a DO/LOOP or FOR/NEXT loop, causes the loop to exit. LEAVE should be used inside an IF...THEN block.
DO
LOOP
FOR
NEXT
LEAVE
IF
THEN
: TEST ( -- ) 10000 0 DO I . I 50 = IF ." EXITING EARLY" CR LEAVE THEN LOOP ;
In this example, the loop is supposed to execute 10,000 times. However, the loop exits when the index is equal to 50.
none