* Why am I getting "missing operand" from get_line()?
@ 2016-05-30 20:31 John Smith
2016-05-30 20:36 ` Egil H H
0 siblings, 1 reply; 9+ messages in thread
From: John Smith @ 2016-05-30 20:31 UTC (permalink / raw)
This is my code:
-- run_time_entry.adb:
with Ada.Text_IO.Unbounded_IO;
with Ada.Text_IO;
procedure Run_Time_Entry is
First_Name : Ada.Strings.Unbounded.Unbounded_String;
Last_Name : Ada.Strings.Unbounded.Unbounded_String;
begin
Ada.Text_IO.Put("Hello. What is your first name => ");
First_Name := Ada.Text_IO.Unbounded_IO.Get_Line();
Ada.Text_IO.Put("What is your last name => ");
Last_Name := Ada.Text_IO.Unbounded_IO.Get_Line();
Ada.Text_IO.Put("Nice to meet you ");
Ada.Text_IO.Unbounded_IO.Put(First_Name);
Ada.Text_IO.Put(" ");
Ada.Text_IO.Unbounded_IO.Put_Line(Last_Name);
end Run_Time_Entry;
This is what happens when I compile it:
> gnatmake -g .\run_time_entry.adb
gcc -c -I.\ -g -I- .\run_time_entry.adb
run_time_entry.adb:11:51: missing operand
run_time_entry.adb:13:51: missing operand
gnatmake: ".\run_time_entry.adb" compilation error
Lines 11 and 13 is where I call Get_Line. I don't understand, the reference manual (for 2012) says that this function ought to exist and it returns a string.
What am I missing?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Why am I getting "missing operand" from get_line()?
2016-05-30 20:31 Why am I getting "missing operand" from get_line()? John Smith
@ 2016-05-30 20:36 ` Egil H H
2016-05-30 23:09 ` John Smith
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Egil H H @ 2016-05-30 20:36 UTC (permalink / raw)
On Monday, May 30, 2016 at 10:31:23 PM UTC+2, John Smith wrote:
> Lines 11 and 13 is where I call Get_Line. I don't understand, the reference manual (for 2012) says that this function ought to exist and it returns a string.
>
> What am I missing?
Parameterless subprograms don't take parenthesis in Ada
--
~egilhh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Why am I getting "missing operand" from get_line()?
2016-05-30 20:36 ` Egil H H
@ 2016-05-30 23:09 ` John Smith
2016-05-30 23:59 ` Jeffrey R. Carter
2016-05-31 5:40 ` Egil H H
2016-06-01 22:21 ` daserlang
2016-06-02 12:57 ` mockturtle
2 siblings, 2 replies; 9+ messages in thread
From: John Smith @ 2016-05-30 23:09 UTC (permalink / raw)
On page 459 of the 2012 reference manual, on the last line, I can clearly see that Get_Line() does not take any inputs and returns an unbounded string.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Why am I getting "missing operand" from get_line()?
2016-05-30 23:09 ` John Smith
@ 2016-05-30 23:59 ` Jeffrey R. Carter
2016-05-31 0:12 ` John Smith
2016-05-31 5:40 ` Egil H H
1 sibling, 1 reply; 9+ messages in thread
From: Jeffrey R. Carter @ 2016-05-30 23:59 UTC (permalink / raw)
On 05/30/2016 04:09 PM, John Smith wrote:
> On page 459 of the 2012 reference manual, on the last line, I can clearly see
> that Get_Line() does not take any inputs and returns an unbounded string.
I'm not sure what you're trying to say. Section 6.4 shows the syntax for a
function call. Your code differs from that syntax.
--
Jeff Carter
"When danger reared its ugly head, he bravely
turned his tail and fled."
Monty Python and the Holy Grail
60
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Why am I getting "missing operand" from get_line()?
2016-05-30 23:59 ` Jeffrey R. Carter
@ 2016-05-31 0:12 ` John Smith
0 siblings, 0 replies; 9+ messages in thread
From: John Smith @ 2016-05-31 0:12 UTC (permalink / raw)
On Monday, May 30, 2016 at 7:59:53 PM UTC-4, Jeffrey R. Carter wrote:
> On 05/30/2016 04:09 PM, John Smith wrote:
> > On page 459 of the 2012 reference manual, on the last line, I can clearly see
> > that Get_Line() does not take any inputs and returns an unbounded string.
>
> I'm not sure what you're trying to say. Section 6.4 shows the syntax for a
> function call. Your code differs from that syntax.
>
> --
> Jeff Carter
> "When danger reared its ugly head, he bravely
> turned his tail and fled."
> Monty Python and the Holy Grail
> 60
I'm talking about A.10.12.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Why am I getting "missing operand" from get_line()?
2016-05-30 23:09 ` John Smith
2016-05-30 23:59 ` Jeffrey R. Carter
@ 2016-05-31 5:40 ` Egil H H
2016-05-31 5:51 ` Niklas Holsti
1 sibling, 1 reply; 9+ messages in thread
From: Egil H H @ 2016-05-31 5:40 UTC (permalink / raw)
On Tuesday, May 31, 2016 at 1:09:17 AM UTC+2, John Smith wrote:
> On page 459 of the 2012 reference manual, on the last line, I can clearly see that Get_Line() does not take any inputs and returns an unbounded string.
No, you can clearly see that Get_Line does not take any inputs and returns an unbounded string. Like I said, it does not take parenthesis
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Why am I getting "missing operand" from get_line()?
2016-05-31 5:40 ` Egil H H
@ 2016-05-31 5:51 ` Niklas Holsti
0 siblings, 0 replies; 9+ messages in thread
From: Niklas Holsti @ 2016-05-31 5:51 UTC (permalink / raw)
On 16-05-31 08:40 , Egil H H wrote:
> On Tuesday, May 31, 2016 at 1:09:17 AM UTC+2, John Smith wrote:
>> On page 459 of the 2012 reference manual, on the last line, I can
>> clearly see that Get_Line() does not take any inputs and returns an
>> unbounded string.
>
> No, you can clearly see that Get_Line does not take any inputs and
> returns an unbounded string. Like I said, it does not take
> parenthesis
Just to make it very clear: a parameterless call in Ada consists of just
the subprogram name, without any ().
Do not write:
First_Name := Ada.Text_IO.Unbounded_IO.Get_Line();
Do write:
First_Name := Ada.Text_IO.Unbounded_IO.Get_Line;
HTH,
--
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
. @ .
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Why am I getting "missing operand" from get_line()?
2016-05-30 20:36 ` Egil H H
2016-05-30 23:09 ` John Smith
@ 2016-06-01 22:21 ` daserlang
2016-06-02 12:57 ` mockturtle
2 siblings, 0 replies; 9+ messages in thread
From: daserlang @ 2016-06-01 22:21 UTC (permalink / raw)
On Monday, May 30, 2016 at 4:36:28 PM UTC-4, Egil H H wrote:
> On Monday, May 30, 2016 at 10:31:23 PM UTC+2, John Smith wrote:
> > Lines 11 and 13 is where I call Get_Line. I don't understand, the reference manual (for 2012) says that this function ought to exist and it returns a string.
> >
> > What am I missing?
>
> Parameterless subprograms don't take parenthesis in Ada
>
> --
> ~egilhh
Yes, you are correct. Your answer became more obvious after I returned to the problem with a fresh head.
Thank you.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Why am I getting "missing operand" from get_line()?
2016-05-30 20:36 ` Egil H H
2016-05-30 23:09 ` John Smith
2016-06-01 22:21 ` daserlang
@ 2016-06-02 12:57 ` mockturtle
2 siblings, 0 replies; 9+ messages in thread
From: mockturtle @ 2016-06-02 12:57 UTC (permalink / raw)
>
> Parameterless subprograms don't take parenthesis in Ada
>
It is almost like trying to exit from vi with C-x C-c... :-) (I could not resist)
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-06-02 12:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-30 20:31 Why am I getting "missing operand" from get_line()? John Smith
2016-05-30 20:36 ` Egil H H
2016-05-30 23:09 ` John Smith
2016-05-30 23:59 ` Jeffrey R. Carter
2016-05-31 0:12 ` John Smith
2016-05-31 5:40 ` Egil H H
2016-05-31 5:51 ` Niklas Holsti
2016-06-01 22:21 ` daserlang
2016-06-02 12:57 ` mockturtle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox