I went through each line and I am stuck as to why the syntax isn't pushing through.

Oops, try again. Your syntax doesn't look quite right. Feel free to peek back at the first exercise if you need help!

(ruby):24: syntax error, unexpected tFID, expecting keyword_then or ';' or '\n'
(ruby):32: syntax error, unexpected keyword_when, expecting $end
when 'display'

movies = {
    Moana: 5,
    Arrival: 5,
    Fast8: 5
    puts "Add, update, display, or delete a movie."

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 on a scale of 1-5?"
    rating = gets.chomp
    movies[title.to_sym] = rating.to_i
    puts "#{title} has been added with a rating of #{rating}."
    puts "That movie already exists!"
when 'update'
    puts "Which movie?"
    title = gets.chomp
    if movies[title.to_sym]nil?
    puts "No bueno."
        puts "Set a new rating."
    rating = gets.chomp
    movies[title.to_sym] = rating.to_i
    puts "#{title} is now updated with a rating of #{rating}!"
when 'display'
    puts "Movies!"
when 'delete'
    puts "Deleted!"
    puts "Error!"


when you are checking if something is equal to something you need to use a double = sign (==) .

You have two places you need that.


... is a little bit undescribed. It's just out here with 'when'. Mightn't have nay to do with the problem but raises a brow or two.


movies[title.to_sym] == rating.to_i



I'm feeling a bit confused. Can you clarify?


The end keyword is valid, but the placement in the structure would have us believe it is somehow paired with the when which we know to be false, as it is paired with the if in actual fact. Ruby indentation is ignored by the interpreter, but useful to the reader to delineate block structures. It is semantic in nature so should be suggestive of the right object.

No. What you have in the original code is correct.

This line is missing the dot. See your line higher up for reference.


You are so awesome! I understand now.

The spacing itself doesn't block the code but the indentation aligns itself with the correct object.

The dot! Long study sessions play with my eyes.

Thank you so much for taking the time. Truly appreciated.


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