Keyboard input/Obtain a Y or N response: Difference between revisions
Keyboard input/Obtain a Y or N response (view source)
Revision as of 02:45, 26 April 2016
, 8 years agono edit summary
m (→{{header|REXX}}: changed/added comments and whitespace, changed indentations.) |
No edit summary |
||
Line 881:
End;
End;</lang>
=={{header|PowerShell}}==
This is for console use only. The ISE is geared for a different type of input.
<lang PowerShell>
do
{
$keyPress = [System.Console]::ReadKey()
}
until ($keyPress.Key -eq "Y" -or $keyPress.Key -eq "N")
$keyPress | Format-Table -AutoSize
</lang>
If the user pressed the "Y" key...
{{Out}}
<pre>
KeyChar Key Modifiers
------- --- ---------
y Y 0
</pre>
If the user pressed the "N" key...
{{Out}}
<pre>
KeyChar Key Modifiers
------- --- ---------
n N 0
</pre>
=={{header|PureBasic}}==
|