Keyboard input/Keypress check: Difference between revisions
Rename Perl 6 -> Raku, alphabetize, minor clean-up
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
|||
Line 16:
If key was pressed, Available is set to True and Ch contains the value.
If not, Available is set to False.
=={{header|ARM Assembly}}==
{{works with|as|Raspberry Pi}}
Line 431 ⟶ 432:
<lang AutoHotkey>; KeyIsDown := GetKeyState("KeyName" [, "Mode"])
State := GetKeyState("RButton", "P") ; Right mouse button. P = Physical state.</lang>
=={{header|AWK}}==
<lang AWK>
Line 622 ⟶ 624:
end.</lang>
=={{header|Elena}}==
{{trans|C#}}
Line 648 ⟶ 651:
<lang Euphoria>integer key
key = get_key() -- if key was not pressed get_key() returns -1</lang>
=={{header|F_Sharp|F#}}==
Line 859 ⟶ 861:
keypresswindow()
</lang>
=={{header|Kotlin}}==
Line 946 ⟶ 947:
If keypress(32) then k$=" "
</lang>
=={{header|MiniScript}}==▼
{{works with|Mini Micro}}▼
<lang MiniScript>x = key.available</lang>▼
=={{header|Oforth}}==
<lang Oforth>import: console
Line 959 ⟶ 965:
System.Console receiveChar ->aChar // Wait until a character is pressed. All other keys are ignored
System.Console receiveTimeout(0) ->key // Check if a key is pressed and return immediatly</lang>
▲=={{header|MiniScript}}==
▲{{works with|Mini Micro}}
▲<lang MiniScript>x = key.available</lang>
=={{header|Perl}}==
Line 1,031 ⟶ 1,033:
This code prints <code>"doing something"</code> 10 times and then ends. Parallelly another process prints every key you type in.
=={{header|Perl 6}}==▼
{{works with|Rakudo|2018.10}}▼
<lang perl6>use Term::ReadKey;▼
react {▼
whenever key-pressed(:!echo) {▼
given .fc {▼
when 'q' { done }▼
default { .uniname.say }▼
}▼
}▼
}</lang>▼
=={{header|Phix}}==
Line 1,057 ⟶ 1,045:
$key = $Host.UI.RawUI.ReadKey()
}</lang>
=={{header|PureBasic}}==▼
Returns a character string if a key is pressed during the call of Inkey(). It doesn't interrupt (halt) the program flow. ▼
If special keys (non-ASCII) have to be handled, RawKey() should be called after Inkey(). ▼
<lang PureBasic>k$ = Inkey()</lang>▼
=={{header|Python}}==
Line 1,111 ⟶ 1,105:
main()
</lang>
▲=={{header|PureBasic}}==
▲Returns a character string if a key is pressed during the call of Inkey(). It doesn't interrupt (halt) the program flow.
▲If special keys (non-ASCII) have to be handled, RawKey() should be called after Inkey().
▲<lang PureBasic>k$ = Inkey()</lang>
=={{header|Racket}}==
Line 1,139 ⟶ 1,127:
(printf "You didn't press a key\n")))
</lang>
(formerly Perl 6)
▲{{works with|Rakudo|2018.10}}
▲<lang perl6>use Term::ReadKey;
▲react {
▲ whenever key-pressed(:!echo) {
▲ given .fc {
▲ when 'q' { done }
▲ default { .uniname.say }
▲ }
▲ }
▲}</lang>
=={{header|REXX}}==
Line 1,190 ⟶ 1,193:
y
</lang>
=={{header|Scala}}==
Line 1,226 ⟶ 1,228:
})
}</lang>
=={{header|Seed7}}==
The library [http://seed7.sourceforge.net/libraries/keybd.htm keybd.s7i] defines
|