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,4227f66b399d97f5 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 21 Nov 2008 19:12:04 +0100 From: Georg Bauhaus User-Agent: Thunderbird 2.0.0.18 (Macintosh/20081105) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Help, asking for code to print out an enumerated type References: <37008a4c-cdbf-42f4-b806-352501419ff6@n33g2000pri.googlegroups.com> <7f31b71b-f8d0-4721-8abe-aa5075172446@s9g2000prg.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Message-ID: <4926f9f5$0$32672$9b4e6d93@newsspool2.arcor-online.net> Organization: Arcor NNTP-Posting-Date: 21 Nov 2008 19:12:05 CET NNTP-Posting-Host: e1baf4c9.newsspool2.arcor-online.net X-Trace: DXC=IeJ_6ZIFPdGX36K@\WTHGJA9EHlD;3YcB4Fo<]lROoRA^YC2XCjHcbIDiF:K0ILb8A;9OJDO8_SKFNSZ1n^B98iJjR>9R?_g>mK X-Complaints-To: usenet-abuse@arcor.de Xref: g2news1.google.com comp.lang.ada:2737 Date: 2008-11-21T19:12:05+01:00 List-Id: ChristopherL schrieb: > On Nov 21, 9:24 am, Anh Vo 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.