with Ada.Text_IO,Ada.Integer_Text_IO;
use Ada.Text_IO,Ada.Integer_Text_IO;
procedure LoopDemo is
Index,Count : Integer;
begin
Index:=1;
loop --this is simlest loop
Put("Index=");Put(Index,5);
New_Line;
Index:=Index+1;
exit when Index=5;
end loop;
Index:=1;
loop -- another simplest loop
Put("index=");Put(Index,5);
New_Line;
Index:=Index+1;if Index=5
then exit;
end if;
end loop;
Count:=1;while Count<5 loop --this is the while loop
Put("Count=");Put(Count,5);
New_Line;
Count:=Count+1;
end loop;for Index in 1..4 loop --this is the for loop
Put("Doubled index =");Put(2*Index,5);
New_Line;
end loop;for Count in reverse 5..8 loop --this is the reverse for loop
Put("Triple index =");Put(3*Count,5);
New_Line;
end loop;for Index in 7..11 loop -- an empty loop
null;
end loop;
end LoopDemo;