8. Display...why?


#1

8.Display

Says I havent include my movie name in my"puts"

Can anyone please help me?

movies = {
Inception: 4,
Home: 3,
Matrix: 4
}

puts "Type 'add' to add movie."
puts "Type 'update' to update."
puts "Type 'display' to display movies."
puts "Type delete to remove movies."

choice = gets.chomp
case choice
when "add"
puts "Type in A New Movie Name"
title = gets.chomp.to_sym
puts "What rating will you give your movie?"
rating = gets.chomp.to_i

if movies[title.to_sym].nil? 
movies[title] = rating
puts movies
puts "Your new movie and its rating have been added!"
end

when "update"
puts "Enter the movie title"
title = gets.chomp.to_sym
if movies[title].nil?
puts "Movie not found!"
else
puts "Enter new movie rating"
rating = gets.chomp.to_i
movies[title] = rating
puts "Movie #{title} rating was updated"
end
when "display"
movies.each do |movie,rating|
puts " #{movie}: #{rating}. "
end
when "delete"
puts "Deleted!"
else 
puts "Error!"
end

#2

@arraysolver09650,
Try it using NO extra spaces
like

movies.each {|movie,rating| puts "#{movie}: #{rating}"}

or as you do
`
movies.each do |movie,rating| puts "#{movie}: #{rating}" end