www.delorie.com/gnu/docs/gforth/gforth_90.html   search  
 
Buy GNU books!


Gforth Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.8.2 Simple Loops

 
BEGIN
  code1
  flag
WHILE
  code2
REPEAT

code1 is executed and flag is computed. If it is true, code2 is executed and the loop is restarted; If flag is false, execution continues after the REPEAT.

 
BEGIN
  code
  flag
UNTIL

code is executed. The loop is restarted if flag is false.

Programming style note: To keep the code understandable, a complete iteration of the loop should not change the number and types of the items on the stacks.

 
BEGIN
  code
AGAIN

This is an endless loop.


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003