I can't get this to work


#1


movies = {
Marvel: 4,
Transformers: 3,
The_Minions: 4
}
when "update"
puts "Title:"
title = gets.chomp
if movies[title.to_sym].nil?
puts "This title is not in the database. Use add to add a title"
else
puts "New rating:"
movies[title.to_sym] = gets.chomp.to_i
puts "Movie was updated. New rating: #{movies[title.to_sym]}"
end

`


#2

Seems like you haven't started looking into why that is.

Start by considering how its behaviour is different from what you want it to do. Perhaps that's even enough to figure out in what way the code should be changed.

If you don't know what it should do every step of the way, then read over the instructions some more.

If you don't know where in the code the misbehaviour is, then start adding prints in the code to inspect what happens as it runs. You can make it print out in english what it does step by step and then check the output for logical issues

If you know what should be different, then you'll need to explain what that something is and what's preventing you from fixing it


#3

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