8. Display is giving me a weird error and I can't figure out what's wrong



When I try to display the movies list I get this error message from the console.

movies = {
    finding_dory: 3,
    toy_story: 4,
    bugs_life: 2
puts "Make your choice."
choice = gets.chomp
case choice
when display
    movies.each do |title, rating|
        puts "#{title}: #{rating}"


Your case statement is missing an end - note how it's hanging out on the right side at the bottom


I've tried adding another end

when display
    movies.each do |title, rating|
        puts "#{title}: #{rating}"

Now it gives me this error

(ruby):33: syntax error, unexpected keyword_when, expecting $end
when "delete"

and the only thing on line 33 is end


You just have to change your |title, rating| in |movie, rating|
And then the same for "#{title}: #{rating}" becomes "#{movie}: #{rating}"



Thanks it works now.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.