From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.not.acm.org>
Subject: Re: Why does this input get "skipped"?
Date: Sat, 20 Aug 2016 16:16:30 -0700
Date: 2016-08-20T16:16:30-07:00 [thread overview]
Message-ID: <npaock$8ts$1@dont-email.me> (raw)
In-Reply-To: <07632b3f-f419-4865-a8f8-01b568a6883e@googlegroups.com>
On 08/20/2016 03:41 PM, John Smith wrote:
> This is the snippet in question:
> Ada.Text_IO.Put("Delete a value - > ");
> String_Input := Ada.Text_IO.Unbounded_IO.Get_Line;
> Ada.Text_IO.New_Line;
>
> The purpose is to have the user enter some string and then keep going. When I ran the above code, I found that I saw "Delete a value - > " being printed, but the program didn't even give me a chance to enter some form of text...
>
> Why did my code keep running?
It's impossible to be sure from the little information given, but the most
likely explanation is that there was already a line terminator waiting to be
consumed, and the call to Get_Line consumed it (and any characters preceding
it). This is often the case after a call to something like Ada.Integer_Text_IO.Get.
--
Jeff Carter
"People called Romanes, they go the house?"
Monty Python's Life of Brian
79
next prev parent reply other threads:[~2016-08-20 23:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-20 22:41 Why does this input get "skipped"? John Smith
2016-08-20 23:16 ` Jeffrey R. Carter [this message]
2016-08-21 0:01 ` John Smith
2016-08-21 0:36 ` John Smith
2016-08-22 5:00 ` J-P. Rosen
2016-08-22 22:18 ` rieachus
2016-08-23 6:22 ` J-P. Rosen
2016-08-24 10:34 ` rieachus
2016-08-21 0:50 ` Jeffrey R. Carter
2016-08-21 1:04 ` John Smith
2016-08-21 4:07 ` Jeffrey R. Carter
2016-08-21 0:00 ` rieachus
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox