<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>


DO Search:

In Flow Control Words in TurboForth Kernal

Word Name: DO
Type: Immediate compiling word
Data Stack Signature: max start --
Return Stack Signature: --
Availability: V1.0  V1.1  V1.2
Description:

Begins a DO/LOOP or a DO/+LOOP sequence.

Example:

: TEST ( -- ) 100 0 DO I . LOOP ;

Comment:

The loop begins counting at start. The loop repeats when the word LOOP or +LOOP is encountered. The loop repeats from the word following DO. Each iteration through the loop increases the index value (accessible with the word I). When the index value is equal to max the loop terminates. The word LEAVE may be used to conditionally exit the loop early.

See Also: +LOOP  I  LEAVE  LOOP 

<< Home | About Forth | About TurboForth | Download | Language Reference | Resources | Tutorials | YouTube >>