LoginLogin

Keyboard Input

Root / Programming Questions / [.]

jcoy17Created:
How do I make a keyboard input that only identifies only two characters. Like if Y/N are the only two valid inputs and when you use something else besides those two.. I want it to say "invalid Input" Yes. I am a little new to BASIC code.

INPUT INPUT$

IF INPUT$=="Y" THEN
 PRINT "YES"
ELSEIF INPUT$=="N" THEN
 PRINT "NO"
ELSE
 PRINT "Invalid input"
ENDIF