I want to recall the case until user writes a or b. I do not want to use "case" particularly. I just want to get input from user but not geting something else. If he writes something else he should need to write until he writes a or b.
str = gets.chomp.to_s
case str
when "a"
print "nice a"
when "b"
puts "nice b"
else
puts "please do it again"
end
Aucun commentaire:
Enregistrer un commentaire