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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b971479ef2fe811a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-21 13:38:25 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stueberl.de!teaser.fr!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "Beard, Frank Randolph CIV" Newsgroups: comp.lang.ada Subject: RE: Getting valid Integer values !! Date: Tue, 21 Oct 2003 16:34:52 -0400 Organization: Cuivre, Argent, Or Message-ID: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: melchior.cuivre.fr.eu.org 1066768562 25720 80.67.180.195 (21 Oct 2003 20:36:02 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Tue, 21 Oct 2003 20:36:02 +0000 (UTC) To: "CheGueVerra" , Return-Path: X-MimeOLE: Produced By Microsoft Exchange V6.0.6375.0 content-class: urn:content-classes:message X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Getting valid Integer values !! Thread-Index: AcOYCzm/pWoGl67/R4mwttB5xT7/IQABjlHw X-OriginalArrivalTime: 21 Oct 2003 20:35:01.0818 (UTC) FILETIME=[CD5419A0:01C39812] X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:1320 Date: 2003-10-21T16:34:52-04:00 We have a similar loop that we used on our older console interfaces. Using your example, it would be: ... type IntData_Type is range 1000000..9999999; IntData : IntData_Type :=3D IntData_Type'first; ValidKey : Boolean :=3D false; package Entiers is new Text_io.Integer_io (Num =3D> IntData); begin put_line("Test Valid Key"); loop begin Put(" Enter Key : "); --+ Not Put_Line Entiers.Get(IntData); New_Line(2); exit; exception When Data_error | Constraint_error =3D> New_Line; Put_line(" Error reading value, Integer expected of range = ..."); Skip_line; end; end loop; Put_Line("Valid data entered"); ... I don't follow why you can't use an exit. Frank -----Original Message----- From: CheGueVerra [mailto:chegueverra@hotmail.com] Sent: Tuesday, October 21, 2003 15:12 To: comp.lang.ada@ada-france.org Subject: Getting valid Integer values !! Hi guys it's me again, Well after so much time playing with Ada I think I'm starting to get the beat of it a special thanks to all those who have helped and will help = down the road... Now, after testing a bit, this is the procedure I want to use to make = sure that the Integer values entered are valid and are in the range that I = expect them to be, it seems to be working fine, I'll test some more after the = post, but if you see some things that I Might have not thought of please tell = me so [code snippet] package Entiers is new Text_io.Integer_io (Num =3D> Integer) IntData : integer range 1000000..9999999; ValidKey : Boolean :=3D false; begin put_line("Test Valid Key"); while not ValidKey loop begin Put_line(" Enter Key :"); Entiers.Get(IntData); ValidKey :=3D True; exception When Data_error | Constraint_error =3D> Put_line(" Error reading value, Integer expected of range = ..."); Skip_line; end; end loop; Put_Line("Valid data entered"); ... Keep in mind that I can't use an exit in a loop so I used the boolean = value, it seems to work but ada has surprised me before .... TIA CheGueVerra _______________________________________________ comp.lang.ada mailing list comp.lang.ada@ada-france.org http://www.ada-france.org/mailman/listinfo/comp.lang.ada