Update


#1



whats wrong with this code?
movies = {
 Metro: 1,
 Matrix: 0,
 oslo: 3
 }
puts "What would you like to do?"
choice = gets.chomp

case choice
when "add"
  puts "What movie do you want to add?"
  title = gets.chomp
  if movies[title.to_sym].nil?
    puts "What's the rating? (Type a number 0 to 4.)"
    rating = gets.chomp
    movies[title.to_sym] = rating.to_i
    puts "#{title}: #{rating}"
  else
    puts "That movie already exists! Its rating is #{movies[title.to_sym]}."
  end
end

puts movies

when "update"
puts "which movie to update?"
text=gets.chomp
if movie[title.to_sym].nil?
    puts "error!"
else
    movies[title.to_sym]
    puts "rate the movie out of 5"
    text=gets.chomp
    movies[title]=rating
end




Replace this line with your code.


#2

A post was merged into an existing topic: Night at movies


#3