From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,66144fcff23c0cc6 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.24.130 with SMTP id u2mr12154042wif.6.1357297880665; Fri, 04 Jan 2013 03:11:20 -0800 (PST) Path: i11ni351494wiw.0!nntp.google.com!proxad.net!feeder1-2.proxad.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail From: Brian Drummond Newsgroups: comp.lang.ada Subject: Re: Trouble with loop in Ada Date: Fri, 4 Jan 2013 11:11:20 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: Mime-Version: 1.0 Injection-Date: Fri, 4 Jan 2013 11:11:20 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="dfff62e1e537b55df42008571c03e0fe"; logging-data="3306"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19OnGrdBaHjaRw9kLHmIQx3tTyhdJXP+uU=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:oyLPqmVjbwuC5JPZhknbQKxU04o= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: 2013-01-04T11:11:20+00:00 List-Id: On Fri, 04 Jan 2013 10:59:24 +0000, Brian Drummond wrote: > On Fri, 04 Jan 2013 04:32:28 +0000, Derek Wyss wrote: > >> Hello, >> >> I'm new to Ada and I'm trying to write a toy unix command shell just to >> explore the programming language. > > Now the good news : loops are more flexible in Ada; there are other ways > of using them. So your immediate problem can be solved by: Better... loop Put("Enter a character> "); exit when End_Of_File; Get(input_char); Put("you entered: " & input_char); New_line; end loop; With the exit at the bottom of the loop, its End_Of_File test required a second line of input (even just a ). This version performs the test on the same line seen by the Get. - Brian