-- Three kinds of loops with ada.text_io; use ada.text_io; with ada.integer_text_io; use ada.integer_text_io; procedure loops1 is i: Integer; p: Positive; s: Natural := 0; begin -- Sum first 10 Positives for j in 1 .. 10 loop -- Implicit declaration s := s + j; end loop; put_line(s'img); -- put_line(j'img); -- Compilation error -- Sum second 10 Positives s := 0; p := 11; while p <= 20 loop s := s + p; p := p + 1; end loop; put_line(s'img); -- Sum some numbers from input s := 0; loop get(i); exit when i < 0; s := s + i; end loop; put_line(s'img); end loops1; -- Input: 3 5 11 -1 -- Output: --| 55 --| 155 --| 19