-
-
Save coaxial/9c875520e7c9d8fc9af1 to your computer and use it in GitHub Desktop.
downcase! method not working on lower case strings?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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