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


#1



https://www.codecademy.com/courses/ruby-beginner-en-0i8v1/0/8?curriculum_id=5059f8619189a5000201fbcb#


When I try to display the movies list I get this error message from the console.
"#Context:0x00000001ea33b8>"Error!


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}"
    end


#2

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


#3

I've tried adding another end

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

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


#4

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

Cheers!


#5

Thanks it works now.


#6

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