Keyboard input/Keypress check: Difference between revisions
Content added Content deleted
No edit summary |
(Keyboard input/Keypress check in various BASIC dialents (BASIC256, QBasic and Yabasic)) |
||
Line 504: | Line 504: | ||
=={{header|BASIC}}== |
=={{header|BASIC}}== |
||
⚫ | |||
⚫ | |||
==={{header|BaCon}}=== |
==={{header|BaCon}}=== |
||
Line 513: | Line 516: | ||
END IF</lang> |
END IF</lang> |
||
==={{header| |
==={{header|BASIC256}}=== |
||
<lang freebasic>do |
|||
⚫ | |||
k$ = key |
|||
until k$ <> "" |
|||
if length(k$) = 2 then |
|||
print "The key pressed was "; k$; " (ascii "; chr(k$); ")" |
|||
else |
|||
print "An extended key was pressed" |
|||
end if</lang> |
|||
==={{header|BBC BASIC}}=== |
|||
⚫ | |||
⚫ | |||
⚫ | |||
==={{header|IS-BASIC}}=== |
==={{header|IS-BASIC}}=== |
||
Line 522: | Line 538: | ||
<lang IS-BASIC>100 GET K$</lang> |
<lang IS-BASIC>100 GET K$</lang> |
||
==={{header|QBasic}}=== |
|||
<lang QBasic>DO: k$ = INKEY$: LOOP UNTIL k$ <> "" |
|||
PRINT k$</lang> |
|||
==={{header|Yabasic}}=== |
|||
<code>inkey$</code> interrupts (halt) the flow of the program until a key is pressed. |
|||
<code>inkey$</code> may only be used, if <code>clear screen</code> has been called at least once. |
|||
<lang yabasic>clear screen |
|||
k$ = inkey$</lang> |
|||
==={{header|ZX Spectrum Basic}}=== |
==={{header|ZX Spectrum Basic}}=== |
||
Line 529: | Line 556: | ||
20 LET k$ = INKEY$</lang> |
20 LET k$ = INKEY$</lang> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|C}}== |
=={{header|C}}== |