Mega Code Archive

 
Categories / Ruby / Statement
 

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