Keyboard input/Keypress check: Difference between revisions
Content added Content deleted
(+perl) |
|||
Line 449: | Line 449: | ||
System.Console receiveChar ->aChar // Wait until a character is pressed. All other keys are ignored |
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> |
System.Console receiveTimeout(0) ->key // Check if a key is pressed and return immediatly</lang> |
||
=={{header|Perl}}== |
|||
<lang perl>#!/usr/bin/perl |
|||
use strict; |
|||
use warnings; |
|||
use Term::ReadKey; |
|||
ReadMode 4; |
|||
my $key; |
|||
until(defined($key = ReadKey(-1))){ |
|||
# anything |
|||
} |
|||
print "got key '$key'\n"; |
|||
ReadMode 0;</lang> |
|||
=={{header|Phix}}== |
=={{header|Phix}}== |