11-06-2022, 01:20 PM
(11-06-2022, 01:11 PM)OldMoses Wrote:(11-06-2022, 12:59 PM)SMcNeill Wrote: PRINT "Enter a digit"
DO
K$ = INPUT$(1)
LOOP UNTIL K$ >= "0" AND K$ <= "6"
PRINT K$
Ooooh, INPUT$, I never noticed that one before. A pretty new bauble to play with.
INPUT$ is as old as the language itself -- nothing new or pretty about it! Honestly though, INPUT$ should get a *LOT* more use than what it does. What it does is:
1) Wait for a set number of keypresses. (No need for a sleep, limit, or _delay in any loop -- it does all that itself.)
2) Return that number of keypresses back to you.
INPUT$(1) wants 1 keypress. INPUT$(3) waits for the user to press 3 keys. (Or one key 3 times.)
It's simple. It's very efficient. Why it's not used more is beyond me.