Page 1 of 1

Catching Input Errors

Posted: Mon Aug 08, 2022 2:17 pm
by MrVertigo
I am writing a simple program where the user is asked to input the integers 1 or 2.

To catch the error of them putting in a different integer I put in a line: If X <> 1 or X etc

But I’ve noticed that if I input another key that isn’t an integer the program ends. Terminates at the Input X line.

How do I catch this error?

Re: Catching Input Errors

Posted: Mon Aug 08, 2022 3:01 pm
by mrtinb
You can use INKEY$.

Re: Catching Input Errors

Posted: Mon Aug 08, 2022 3:11 pm
by 1024MAK
I suggest using either a string with INPUT or better yet, program your own input routine using INKEY$.

For example:
Choice using INKEY$
Choice using INKEY$
(Choice using INKEY$)

Mark

Re: Catching Input Errors

Posted: Mon Aug 08, 2022 3:36 pm
by MrVertigo
Inkeys sounds like it will be ideal, thanks!

Re: Catching Input Errors

Posted: Mon Aug 08, 2022 3:38 pm
by XavSnap
Cap0000.jpg
Cap0000.jpg (10.52 KiB) Viewed 1445 times