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=3.8 required=5.0 tests=BAYES_00,INVALID_MSGID, RATWARE_MS_HASH,RATWARE_OUTLOOK_NONAME autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,eee47022b0e39dbb X-Google-Attributes: gid103376,public From: "Keith Allan Shillington" Subject: Re: Exception problem Date: 1997/02/19 Message-ID: <01bc1e81$850234a0$fc00af88@godiva>#1/1 X-Deja-AN: 219872309 Sender: news@thomsoft.com (USENET News Admin @flash) X-Nntp-Posting-Host: leonidas References: <330A0D25.313@fs2.assist.uci.edu> Organization: Aonix Newsgroups: comp.lang.ada Date: 1997-02-19T00:00:00+00:00 List-Id: Classic error. If you input a non-numeric character, it gets "stuck" in the input buffer and never processed. To throw away unwanted characters in the input buffer, the simplest thing to do is add a call to Text_IO.Skip_Line in each of your handlers. Larry Coon wrote... > > declare > X: Positive; > package Int_IO is new Integer_IO (Integer); > use Int_IO; > begin > loop > begin > Put ("Enter a positive number: "); > Get (X); > exit; -- No exception, so input was valid. > exception > when Constraint_Error => > Put_Line ("Entry must be positive. Try again."); Skip_Line; > when Data_Error => > Put_Line ("Entry must be a number. Try again."); Skip_Line; > end; > end loop; ...