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

m
Use inputReady instead of the deprecated function keypress
(New post.)
m (Use inputReady instead of the deprecated function keypress)
 
(2 intermediate revisions by 2 users not shown)
Line 1,110:
The task specification that there should be no need for the user to press the enter key,
creates an awkward situation for the Java language.
 
However, a short program that waits for the user to press return can easily be constructed.
<syntaxhighlight lang="java">
Line 2,049 ⟶ 2,050:
var char: answer is ' ';
begin
while keypressedinputReady(KEYBOARD) do
ignore(getc(KEYBOARD));
end while;
Line 2,333 ⟶ 2,334:
 
=={{header|Wren}}==
<syntaxhighlight lang="ecmascriptwren">import "io" for Stdin, Stdout
 
Stdin.isRaw = true // input is neither echoed nor buffered in this mode
29

edits