Pascal - Loop with condition on the beginning: while do

Condition testing is done at the beginning of the loop. before each iteration the condition is tested, if it is was true. before the first iteration is a condition test, the use of this loop is excellent in situations where perhaps we don't need to execute the cycle.

while do

Description

while condition do statement;
Used keywords: do while

Input

Note: Here usable statements:
break statement continue statement
Compatible programing languages:
Object Pascal | Free Pascal

Examples

Pascal

Loop with condition on the beginning the possible of use:
i:=0;
while i<10 do inc(i);
x :=0;
while i<20 do
begin
 i:= i+2;
 if i=16 then
 begin
    continue
 end;
 inc(x); 
end;

Pascal

Other pieces of example codes:
while i>0 do
   if i=10 then
     break
   else 
   begin
     dec(i);
   end;
while y>1 do
begin
  inc(x);
  dec(y);
end;
if  x >= 12 then
   while  y >= 0 do  
      dec(y);
while  y <= 32 do  
   inc(y);
Languages: en hu cz sk