Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Ada Syntax

Name: Ada newbie 2010-10-05 19:54

sup /prog/.

Just one question. How do I assign a value to an unbounded string via the get command?

example:

procedure blabla is
type car is record
name : unbounded_string;
...
end record;
begin
put ("bla");
get (car.name); <---- error
end blabla;

libraries used: Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings, Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO

no candidate interpretations match the actuals:
missing argument for parameter "item" in call to "get" declared at ...

I hope this is specific enough so somebody that knows the language can solve my problem in a second.

I simply can't find an extensive but simple syntax guide for ada on the web, the ones I find always miss that one problem I have....

Name: Anonymous 2010-10-05 19:59

My other car is a cdr.

Name: Anonymous 2010-10-05 20:01

if you want to learn Ada, I recommend starting out with the interactive Ada Tutor as there are no easy Ada books out
http://www.adatutor.com/

Name: Anonymous 2010-10-05 20:03

>>3
I'm learning it atm. I was in 2 short lectures that covered the basics and I've read loads of tutorials. The problem is that none of them seems to cover the case I described in the OP.

Thanks tho.

Name: Anonymous 2010-10-05 20:07

>>4
actually, I'm pretty sure that I just haven't learned enough to actually get the more advanced tutorials.
I still hope that somebody can just tell me how to write that one command.

Name: Anonymous 2010-10-05 20:17

bump, still searching.

Name: Anonymous 2010-10-05 20:21

I think a record in Ada is a dictionary, meaning a variable assigned to a keyword...so I dont think dot notation will work for adding to a record

Name: Anonymous 2010-10-05 20:25

i actually tried that one because my tutorials didnt show the exact example.

type car is record
    price : natural := 500;
end record;
loadsofcars : array(1..10) of car;
begin
put (loadsofcars(1).price);
end ....;


puts 500.


actually, let me paste my example. fuck it, it's 2:30 am and i'm entering full on nerd mode


WITH Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings, Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO;
USE Ada.Text_IO, Ada.Integer_Text_IO, Ada.Strings, Ada.Strings.Unbounded, Ada.Strings.Unbounded.Text_IO;

PROCEDURE Test IS
   TYPE arecord IS RECORD
      astring : Unbounded_String := To_Unbounded_String ("blatext");
      apos : Positive := (500);
      abool : Boolean := False;
   END RECORD;
   anarray : array (1..10) of arecord;
   BEGIN

put (anarray(1).astring);

END Test;

Name: Anonymous 2010-10-05 20:27

oh wait, you said adding to.
what's the proper syntax then?

Name: Anonymous 2010-10-05 20:47

last bump before bed
anybody? this should be easy...

Name: Anonymous 2010-10-05 23:24

>>10
Maybe you should take a class in noose-tying

Name: Anonymous 2010-12-17 1:30

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2011-02-04 17:04

Don't change these.
Name: Email:
Entire Thread Thread List