Skip to content

Instantly share code, notes, and snippets.

@coaxial
Last active December 26, 2015 03:19
Show Gist options
  • Save coaxial/9c875520e7c9d8fc9af1 to your computer and use it in GitHub Desktop.
Save coaxial/9c875520e7c9d8fc9af1 to your computer and use it in GitHub Desktop.
downcase! method not working on lower case strings?
movies = {
:H2G2 => 3.5,
:AlienI => 3.5,
:Minority_Report => 3,
:After_Earth => 1.5
}
puts "What would you like to do (add, update, display or delete)?"
choice = gets.chomp.downcase!
case choice
when "add"
puts "Added!"
when "update"
puts "Updated!"
when "display"
puts "Displayed!"
when "delete"
puts "Deleted!"
else
puts "Invalid command"
end
# second example
movies = {
:H2G2 => 3.5,
:AlienI => 3.5,
:Minority_Report => 3,
:After_Earth => 1.5
}
puts "What would you like to do (add, update, display or delete)?"
choice = gets.chomp
case choice.downcase!
when "add"
puts "Added!"
when "update"
puts "Updated!"
when "display"
puts "Displayed!"
when "delete"
puts "Deleted!"
else
puts "Invalid command"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment