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

m
→‎{{header|GWBASIC}}: Fixed GW-BASIC header
No edit summary
m (→‎{{header|GWBASIC}}: Fixed GW-BASIC header)
Line 291:
The loop on lines 30 - 40 will cycle as fast as the interpreter can go, assigning K$ the empty string until the user presses a key. On versions of BASIC later than the 2.0 on the VIC and 64 (e.g. 3.5 on the C-16 and Plus/4, 7.0 on the C-128), GETKEY may be used in place of GET. GETKEY will wait for the user to press a key before continuing, so the polling is done in the BASIC interpreter's machine language code, and the BASIC loop only cycles when the user presses a key other than Y or N.
 
==={{header|GWBASICGW-BASIC}}===
{{works with|QBasic}}
 
<lang gwbasic>10 CLS: PRINT "Press Y or N to continue."
20 WHILE T$<>"y" AND T$<>"Y" AND T$<>"n" AND T$<>"N"
Line 304:
</lang>
 
===={{header|GWBASICGW-BASIC variant}}====
<lang gwbasic>10 DEF FNUP$(C$)=CHR$(ASC(C$)-32*(ASC(C$)>96)*(ASC(C$)<123))
<lang gwbasic>
10 DEF FNUP$(C$)=CHR$(ASC(C$)-32*(ASC(C$)>96)*(ASC(C$)<123))
20 CLS: PRINT "Press Y or N to continue."
30 WHILE T$<>"Y" AND T$<>"N"
Line 312 ⟶ 311:
50 IF T$<>"Y" AND T$<>"N" THEN BEEP
60 WEND
70 PRINT "The response was: "; T$</lang>
</lang>
 
==={{header|IS-BASIC}}===
2,130

edits