-- Demonstrates a while not end of file loop -- Reads input from standard input. -- To read from file (such as some_data.txt), redirect the input: -- ./demo_input < some_data.txt -- If some_data.txt contains: --| 33 --| 44 55 --| 66 -- The output will be: --| 33 --| 44 --| 55 --| 66 -- Two things to watch out for: -- 1. Make sure that you create your data file on same OS as you -- use for compiling. You may need to type in your data rather -- than cutting and pasting from the web. -- 2. There should be no white space after the last data value in -- your file -- with ada.integer_text_io; use ada.integer_text_io; with ada.text_io; use ada.text_io; procedure demo_input is i: Integer; begin while not end_of_file loop get(i); put(i, 3); new_line; end loop; -- Other loops that we looked at: -- for j in 1 .. 10 loop -- hmm, is j declared anywhere? -- get(i); -- put(i, width => 5); -- end loop; -- get(i); -- while i > 0 loop -- put(i, width => 5); -- get(i); -- end loop; -- -- loop and a half: -- loop -- get(i); -- exit when i < 0 loop -- put(i, width => 5); -- end loop; end demo_input;