comp.lang.ada
 help / color / mirror / Atom feed
From: franke@minet.uni-jena.de (Frank Ecke)
Subject: Re: loop and constraint error
Date: 1998/10/12
Date: 1998-10-12T00:00:00+00:00	[thread overview]
Message-ID: <slrn72450c.ork.franke@pax01f.mipool.uni-jena.de> (raw)
In-Reply-To: 3620E968.526B@attcanada.net

On Sun, 11 Oct 1998 17:13:09 GMT, Kas_le_chat <kasino@attcanada.net> 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 <franke@minet.uni-jena.de>


       In a world without walls and fences, who needs windows and gates?




  reply	other threads:[~1998-10-12  0:00 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-10-11  0:00 loop and constraint error Kas_le_chat
1998-10-12  0:00 ` Frank Ecke [this message]
1998-10-12  0:00   ` loop and constraint error(Thanks that fix .....) Kas_le_chat
1998-10-13  0:00     ` Matthew Heaney
1998-10-13  0:00       ` loop and constraint error(Thanks that fix ..it all) Kas_le_chat
1998-10-12  0:00 ` loop and constraint error- I really nead help for this problem thanks Kas_le_chat
1998-10-12  0:00   ` alan walkington
replies disabled

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