Display error


Code displays properly in editor

please choose a function.
deadpool: 5.
elysium: 3.
spectre: 5.
afterearth: 2.
{:deadpool=>5, :elysium=>3, :spectre=>5, :afterearth=>2}

I still get an error message.

Oops, try again. It looks like your 'puts' doesn't include deadpool: 5.

Here is my code. Can anyone help with the origins of this error?

movies = {
   deadpool: 5,
    elysium: 3,
    spectre: 5,
    afterearth: 2,
puts " please choose a function."
choice = gets.chomp

case choice
when "add"
puts "Please enter a movie title."
title = gets.chomp
puts "please enter rating."
rating = gets.chomp
if movies[title.to_sym].nil?
movies[title.to_sym] = rating.to_i
movies[title] = rating
puts "added #{title} with a rating of #{rating}"
else puts "That movie has already been reviewed! Its rating is #{movies[title.to_sym]}"
when "update"
puts "Select movie to update."
title = gets.chomp
if movies[title.to_sym].nil?
    puts "Unknown title"
    movies[title.to_sym] = rating.to_i
    movies[title] = rating
when "display"
movies.each do |movie, rating|
    puts "#{movie}: #{rating}."
when "delete"
puts "Deleted!"
else puts "Error!"


Hello all. I just corrected my own work. My error was the period in: "#{movie: #{rating}." There should be no period after rating in this string. Can anyone explain WHY this created an error?


Only the author can explain SCT errors. They often have more to do with expected string patterns than any console errors. The interpreter does not look for errors inside string objects.


With a program such as this that deals with real entities (movies) it is recommended that the proper names be used in the program so they can be matched without needing interpretation.

movies = {
    Deadpool: 5,
    Elysium: 3,
    Spectre: 5,
    "After Earth" => 2,


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