Using the case Statement : case « Statement « Ruby
- Ruby
- Statement
- case
Using the case Statement
command = "Stop"
case command
when "Go"
puts "Going"
when "Wait"
puts "Waiting"
when "Turn"
puts "Turning"
when "Stop"
puts "Stopping"
else
puts "I can't understand that."
end
Related examples in the same category