From: "CheGueVerra" <chegueverra@hotmail.com>
Subject: Getting valid Integer values !!
Date: Tue, 21 Oct 2003 15:11:34 -0400
Date: 2003-10-21T15:11:34-04:00 [thread overview]
Message-ID: <Fxflb.1900$VQ3.239738@news20.bellglobal.com> (raw)
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 => Integer)
IntData : integer range 1000000..9999999;
ValidKey : Boolean := false;
begin
put_line("Test Valid Key");
while not ValidKey loop
begin
Put_line(" Enter Key :");
Entiers.Get(IntData);
ValidKey := True;
exception
When Data_error | Constraint_error =>
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
next reply other threads:[~2003-10-21 19:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-10-21 19:11 CheGueVerra [this message]
2003-10-21 20:15 ` Getting valid Integer values !! Martin Dowie
2003-10-21 20:27 ` CheGueVerra
2003-10-21 23:04 ` Martin Dowie
2003-10-21 23:35 ` CheGueVerra
2003-10-22 2:49 ` Steve
2003-10-22 0:46 ` Jeffrey Carter
2003-10-22 1:07 ` CheGueVerra
-- strict thread matches above, loose matches on Subject: below --
2003-10-21 20:34 Beard, Frank Randolph CIV
2003-10-21 21:34 ` CheGueVerra
2003-10-21 21:36 ` CheGueVerra
[not found] <mailman.161.1066792253.25614.comp.lang.ada@ada-france.org>
2003-10-22 3:46 ` Jeff C,
2003-10-22 19:27 ` Simon Wright
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox