[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Iterative                Repeat Until Condition Met            Statement Type

    Iterative statements execute a statement repeatedly until some
    condition is met: Either the statement has been executed a fixed
    number of times, or some controlling Boolean expression yields the
    appropriate value. There are three types of iterative statements in
    Pascal:

            <while>   WHILE..DO loop; executes while some Boolean
                      expression is TRUE.

           <repeat>   REPEAT..UNTIL loop; executes until some Boolean
                      expression is TRUE.

              <for>   FOR..DO loop; executes until the index variable
                      passes the ending value.

    In all three cases, once the loop has terminated, execution continues
    with the statement following the loop.

  -------------------------------- Example ---------------------------------

           for Ch := 'a' to 'z' do            { FOR }
             Writeln(Upcase(Ch),'-',Ch);

           Ch := 'a';                         { WHILE }
           while Ch <= 'z' do begin
             Writeln(Upcase(Ch),'-',Ch);
             Ch := Succ(Ch)
           end;

           Ch := 'a';                         { REPEAT }
           repeat
             Writeln(Upcase(Ch),'-',Ch);
             Ch := Succ(Ch)
           until Ch > 'z';

See Also: while repeat for
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson