Keyboard input/Obtain a Y or N response: Difference between revisions
Keyboard input/Obtain a Y or N response (view source)
Revision as of 21:51, 10 June 2019
, 5 years agoadded MiniScript example
Childishbeat (talk | contribs) m (→{{header|Wee Basic}}: The initial print statement has quotation marks at the end.) |
(added MiniScript example) |
||
Line 1,121:
TextWindow.WriteLine(GraphicsWindow.LastKey)
EndSub</lang>
=={{header|MiniScript}}==
Access to hardware like the keyboard is very dependent on the host app, but here's a version that works with [https://miniscript.org/MiniMicro/ MiniMicro], a standardized MiniScript virtual machine.
<lang MiniScript>// flush the keyboard
while key.available
key.get
end while
// and now prompt and wait for Y or N
print "Press Y or N:"
k = ""
while k != "Y" and k != "N"
k = key.get.upper
end while
print "You pressed: " + k</lang>
=={{header|NetRexx}}==
|