Loop structures: Difference between revisions

Content added Content deleted
(→‎[[C plus plus|C++]]: rm duplicate do-while entry, rm extra === Run-Time Control Structures === heading)
Line 224: Line 224:
example: counts down from a given number to one
example: counts down from a given number to one
: COUNTDOWN ( n -- ) BEGIN DUP WHILE CR DUP . 1- REPEAT DROP ;
: COUNTDOWN ( n -- ) BEGIN DUP WHILE CR DUP . 1- REPEAT DROP ;
Additional WHILE clauses may be added to a loop, but each extra WHILE requires a matching THEN after the REPEAT.


===Mixed Structures===
===Mixed Structures===