While Loops
while <condition> {
<code block>
}var input
while !( (input = IO.prompt("[Y/n]> ")) in "Yn" ) {
print "Please enter either 'Y' or 'N'"
}
print "You inputted '#{input}'"[Y/n]> No
Please enter either 'Y' or 'N'
[Y/n]> Yes
Please enter either 'Y' or 'N'
[Y/n]> Y
You inputted 'Y'Last updated
Was this helpful?