Keyboard input/Obtain a Y or N response: Difference between revisions

«Keyboard input/Obtain a Y or N response in various BASIC dialents (BASIC256, QBasic and Yabasic)
m (→‎{{header|GWBASIC}}: Fixed GW-BASIC header)
(«Keyboard input/Obtain a Y or N response in various BASIC dialents (BASIC256, QBasic and Yabasic))
Line 272:
50 PRINT "THE RESPONSE WAS ";K$
</lang>
 
==={{header|BASIC256}}===
<lang freebasic>print "Do you want to continue y/n : ";
do
KBD$ = key
until KBD$ = "89" or KBD$ = "78"
 
print chr(KBD$)
 
if KBD$ = "89" then
print "OK, continuing"
else
print "OK, finishing"
end if</lang>
 
==={{header|QBasic}}===
<lang QBasic>PRINT "Press Y or N to continue."
DO
KBD$ = ""
WHILE KBD$ = ""
KBD$ = UCASE$(INKEY$)
WEND
IF KBD$ <> "Y" AND KBD$ <> "N" THEN BEEP
LOOP UNTIL KBD$ = "Y" OR KBD$ = "N"
PRINT "The response was "; KBD$</lang>
 
==={{header|BBC BASIC}}===
Line 280 ⟶ 305:
UNTIL key$="Y" OR key$="N"
PRINT "The response was " key$</lang>
 
==={{header|Commodore BASIC}}===
<lang basic>10 PRINT "PRESS Y OR N TO CONTINUE:";
Line 322 ⟶ 348:
 
==={{header|Locomotive Basic}}===
 
<lang locobasic>10 CLEAR INPUT
20 PRINT "Press Y or N to continue"
Line 331 ⟶ 356:
70 PRINT "Try again"
80 GOTO 30</lang>
 
==={{header|Yabasic}}===
<lang yabasic>clear screen
 
print "Do you want to continue y/n : ";
 
repeat
KBD$ = lower$(inkey$)
until KBD$ = "y" or KBD$ = "n"
 
print KBD$
if KBD$ = "y" then
print "OK, continuing"
else
print "OK, finishing"
end if</lang>
 
==={{header|ZX Spectrum Basic}}===
2,130

edits