0
我想在CodeCademy上完成「電影之夜」Ruby課程,並遇到一個小問題:我的代碼不通過如果我在choice
上使用downcase!
並且輸入是小寫的 - 如果它包含大寫字母或者完全是大寫字母,則它工作正常。Ruby:我的代碼沒有通過,如果我使用`.downcase!`
這裏是我的代碼:
movies = {
Foo: "Bar",
}
puts "Commands:"
puts "Add - Add a movie and its rating."
puts "Update - Update a movie's rating."
puts "Display - Display all movies and their ratings."
puts "Delete - Delete a movie and its rating."
choice = gets.chomp.downcase!
case choice
when 'add'
puts "Added!"
when 'update'
puts "Updated!"
when 'display'
puts "Movies!"
when 'delete'
puts "Deleted!"
else
puts "Error!"
end
幫助?
你的問題是什麼? – sawa