HELPLIB.HLB  —  PASCAL  Statements  WHILE
  The WHILE statement is a loop that executes a statement while  a
  specified condition is true.

  Syntax:

     WHILE expression DO
        statement

  The 'expression' is any Boolean expression.

  The 'statement' is any VSI Pascal statement.

  VSI Pascal checks the value of  the  Boolean  expression  before
  executing the loop body for the first time; if the expression is
  FALSE, the loop body is not executed.  If the initial  value  is
  TRUE,  loop  iterations  continue  until the condition is FALSE.
  When specifying more than one statement as the loop  body  to  a
  WHILE  statement,  enclose the statements with the BEGIN and END
  reserved words, since the syntax calls for a single statement to
  follow  the  DO  reserved  word.   If  you do not use a compound
  statement for the loop  body,  VSI  Pascal  executes  the  first
  statement following the DO reserved word as the loop body.

1  –  Examples

     WHILE NOT EOLN (INPUT) DO
        BEGIN
        READ (x);
        IF NOT (x IN ['A'..'Z', 'a'..'z', '0'..'9'])
        THEN
           Err := Err + 1;
        END;

  This example reads an input character (x) from the current line.
  If  the  character  is  not  a digit or letter, the error count,
  'Err', is incremented by  one.   The  loop  terminates  when  an
  end-of-line on the INPUT is reached.
Close Help