[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Turbo Pascal Statements
While - Repetitive Statement
A While statement contains an expression that controls the repeated
execution of a statement. The statement can be a compound statement.
The expression must evaluate to a standard boolean value. Unlike
the Repeat statement, the expression is evaluated before the statement
is executed. The statement will execute repeatedly, as long as the
expression evaluates to TRUE. If the expression evaluates to FALSE
at the onset, the statement will never be executed.
+------------+ +-----------+
While ---.| expression |--. Do ---.| statement |--.
+------------+ +-----------+
EXAMPLE: Var
x, y : Integer;
Begin
ReadLn(y);
while (y > 0) Do
Begin
Write('enter 0 to stop ');
ReadLn(y);
End;
End.
See Also:
Boolean
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson