|
Delphi |
|
while loop executes the code while the control condition is True:
var
f: TextFile;
S: string;
..
while not Eof(f) do
begin
Readln(f,S);
// some processing of the S string here
end;
Important feature of while loop is checking the control condition before first iteration, so if the contition is False initially, the loop will never execute. |
|
C# |
|
The while statement executes a statement or a block of statements until a specified expression evaluates to false.
int i = 1;
while( i < 10 )
{
// do something
i++;
}
|
|
|
|
|
|
|