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?
Catching Input Errors
Re: Catching Input Errors
You can use INKEY$.
- 1024MAK
- Posts: 5153
- Joined: Mon Sep 26, 2011 10:56 am
- Location: Looking forward to summer in Somerset, UK...
Re: Catching Input Errors
I suggest using either a string with INPUT or better yet, program your own input routine using INKEY$.
For example: (Choice using INKEY$)
Mark
For example: (Choice using INKEY$)
Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp
Standby alert
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb
Looking forward to summer later in the year.
Re: Catching Input Errors
Inkeys sounds like it will be ideal, thanks!
Last edited by MrVertigo on Mon Aug 08, 2022 3:39 pm, edited 3 times in total.