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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f813b1b9c8de30d6 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-08 10:12:07 PST Path: supernews.google.com!sn-xit-03!supernews.com!cyclone-sf.pbi.net!63.208.208.143!feed2.onemain.com!feed1.onemain.com!europa.netcrusader.net!205.252.116.205!howland.erols.net!newshub2.home.com!news.home.com!news1.rdc1.mi.home.com.POSTED!not-for-mail From: "mcdoobie" Subject: Re: Getting a one-touch option (was: Ada95 tutorials with sample code) Newsgroups: comp.lang.ada Organization: Caffinated Corps References: User-Agent: Pan/0.8.1beta6 (Unix) X-No-Productlinks: Yes Message-ID: Date: Thu, 08 Mar 2001 18:10:18 GMT NNTP-Posting-Host: 24.0.109.49 X-Complaints-To: abuse@home.net X-Trace: news1.rdc1.mi.home.com 984075018 24.0.109.49 (Thu, 08 Mar 2001 10:10:18 PST) NNTP-Posting-Date: Thu, 08 Mar 2001 10:10:18 PST Xref: supernews.google.com comp.lang.ada:5548 Date: 2001-03-08T18:10:18+00:00 List-Id: In article , "Mario Amado Alves" wrote: > Lately I have been using enumerations and exceptions for this kind of > problem: > > type Options is (A, V); Option: Options; C: Character; > begin > loop > Put("Please enter either a 'V' or an 'A'"); Get_Immediate(C); begin > Option := Options'Value(C & ""); exit; > exception > when Constraint_Error => null; > end; > end loop; > > There is of course more to be said about "exception-oriented" > programming. Let us save that for the Ada-Europe'2001 workshop ;-) The whole use of types in Ada has kinda got me confused. For example... the_volume := find_volume( aLength, aWidth, aHeight); Gives me the error message on compile ... "array type required in indexed component" This is NOT an array, it's a function call. Heh, I guess I'll be hitting the books again. Exceptions are something I plan on playing with soon. As soon as I got all the basics worked out. McDoobie Thanks.