hasch | has character function |
Syntax | hasch : boolean |
Description | The hasch procedure is used to determine if there is a
character that has been typed but not yet been read.
|
Example | This program simulates the rolling of a pair of dice until the
user pressed the keyboard.
put "Press any key to stop the dice rolling" var die1, die2 : int var ch : string (1) loop exit when hasch randint (die1, 1, 6) randint (die2, 1, 6) locate (1, 1) put "You rolled ", die1 + die2 end loop getch (ch) % Discard the character
|
Execute | |
Details | The screen should be in a "graphics" mode. See the
setscreen procedure for details. If the screen is not
in "graphics" mode, it will automatically be set
to "graphics" mode. If there is the possibility that there are already keystrokes in the keyboard buffer, the Input.Flush command can be used to flush the keyboard buffer (remove all keystrokes from the buffer) before entering the loop to check for input.
|
See also | getch and
getchar. See also the Input.Flush command for flushing the keyboard buffer. See also predefined unit Input.
|