Repeat until loop


Used when we'll repeat the loop at least once. First executes the loop and then checks the condition. If it is false the loop is repeated again. If it is true the loop stops.

program repeat1;
var
i:integer;
begin
i:=0;
repeat
writeln('i = ',i);
i:=i+1;
until(i>5);
end.





No comments:

Post a Comment