<< 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.
: TEST ( -- )
10000 0 DO
I 50 = IF ." EXITING EARLY" CR LEAVE THEN
In this example, the loop is supposed to execute 10,000 times. However, the loop exits when the index is equal to 50.