with Ada.Text_IO, Ada.Integer_Text_IO;
use Ada.Text_IO, Ada.Integer_Text_IO;
 
procedure Loopsinada is
Index, Count,for_first,for_last : INTEGER;
type my_range is range 2..4 ;
package MY_OWN_TYPE is new Ada.Text_IO.Integer_IO(my_range);
use MY_OWN_TYPE;
begin
put_line("enter user defines for range:");
get(for_first);
get(for_last);
 
new_line;
Index := 1;
loop -- This is the simplest loop
Put("Index =");
Put(Index, 5); 
New_Line;
Index := Index + 1;
exit when Index = 4;
end loop;
new_line;
 
Index := 1;
loop -- Another simplest loop
Put("Index =");
Put(Index, 5); New_Line;
Index := Index * 2;
if Index = 8 then exit; end if;
end loop;
new_line;
 
Count := 48;
while Count > 5 loop -- This is the while loop
Put("Count =");
Put(Count, 5); 
New_Line;
Count := Count /2;
end loop;
new_line;
 
for Index in 1..4 loop -- This is the for loop
Put("Doubled index =");
Put(2 * Index, 5); 
New_Line;
end loop;
new_line;
 
for Count in reverse 5..9 loop -- This is the reverse for loop
Put("Minus count =");
Put(Count-1, 5); New_Line;
end loop;
new_line;
 
for count in my_range loop-- user specified type
put("user count = ");
put(count*4,5);
new_line;
end loop;
new_line;

for count in for_first..for_last loop-- user specified type
put("half count = ");
put(count,5);
new_line;
end loop;
new_line;


 
for Index in 7..11 loop -- An empty loop
null;
end loop;
end Loopsinada;