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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4a3d58309fdb60b2 X-Google-Attributes: gid103376,public From: franke@minet.uni-jena.de (Frank Ecke) Subject: Re: loop and constraint error Date: 1998/10/12 Message-ID: #1/1 X-Deja-AN: 400255549 References: <3620E968.526B@attcanada.net> Organization: Department of Computer Science, FSU Jena, Germany Reply-To: franke@minet.uni-jena.de Newsgroups: comp.lang.ada Date: 1998-10-12T00:00:00+00:00 List-Id: On Sun, 11 Oct 1998 17:13:09 GMT, Kas_le_chat wrote: > In this projet I have to get a quantity between 0 and 50.From that > quantity I have to distribute it in some variables depending on a > certain range.When i am out of that fiel 0..50 the program end whit > constraint error, but I nead it to loop to the get variable and dont > know how to do this. Try procedure A is Quantity : Float range 0.0 .. 50.0; package My_Float_IO is new Ada.Text_IO.Float_IO(Float); use My_Float_IO; begin Enter_Quantity : loop begin Put("Enter a value between 0.0 and 50.0 "); Get(Quantity); exit Enter_Quantity; exception when Constraint_Error => Put_Line("I SAID BETWEEN 0.0 AND 50.0"); when others => Put_Line("Something else went wrong"); end; end loop Enter_Quantity; Put(Quantity); end A; Hope this helps. Frank -- Frank Ecke In a world without walls and fences, who needs windows and gates?