comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Help, asking for code to print out an enumerated type
Date: Fri, 21 Nov 2008 19:12:04 +0100
Date: 2008-11-21T19:12:05+01:00	[thread overview]
Message-ID: <4926f9f5$0$32672$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <c72d282b-044a-44ac-be29-de9de4188418@z27g2000prd.googlegroups.com>

ChristopherL schrieb:
> On Nov 21, 9:24 am, Anh Vo <anhvofrc...@gmail.com> wrote:
>> This code should work for all Ada including Ada 2005. I hope you get
>> the idea to print any
>> enumerated values.
>>
>> with Text_Io;
>> procedure Print_Enum_Values is
>>    I_Prefer_Ada : Boolean := True;   -- type Boolean is (True, False);
>> defined in Standard
>> begin
>>    Text_Io.Put_Line ("Are you prefer Ada? " & Boolean'Image
>> (I_Prefer_Ada));
>> end Print_Enum_Values;
> 
> Ok, here is a fill in the blank question. The question is modify the
> below code to print out
> the contents of variable My_enum.
> 
> procedure test is
>   type chris_type is (apple, orange, tomatoe, pear, peaches, grapes);
>   My_enum:chris_type;
> begin
> 
>    My_enum := grapes;
> 
> end test;

You might want to study the code An Voh has provided.
It does what you want.
Also, and in addition, may I suggest you look at the IO
packages for enumerated types in case An Voh's solution
is not what you like.



  parent reply	other threads:[~2008-11-21 18:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <37008a4c-cdbf-42f4-b806-352501419ff6@n33g2000pri.googlegroups.com>
2008-11-21 16:37 ` Help, asking for code to print out an enumerated type Georg Bauhaus
2008-11-21 17:24 ` Anh Vo
     [not found]   ` <c72d282b-044a-44ac-be29-de9de4188418@z27g2000prd.googlegroups.com>
2008-11-21 18:12     ` Georg Bauhaus [this message]
     [not found]       ` <04e810ee-d4f0-4947-b7c9-78790706d20f@s9g2000prg.googlegroups.com>
2008-11-21 18:52         ` Georg Bauhaus
2008-11-21 21:10   ` Jeffrey R. Carter
2008-11-21 21:19     ` Anh Vo
2008-11-21 21:26       ` Anh Vo
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox