-- Demonstrates end of file loop
-- When doing interactive input mark eof with
-- ctrl-Z on a separate line for windows
-- ctrl-D for unix
with ada.text_io; use ada.text_io;
with ada.integer_text_io; use ada.integer_text_io;
procedure eof is
n: Natural;
s: Natural := 0;
begin
while not end_of_file loop
get(n);
put_line(n'img);
s := s + n;
end loop;
put_line(s'img);
end eof;
-- Input: 3 4 5
-- Output:
--| 3
--| 4
--| 5
--| 12