4 promoting redux


#1

Hi I have read some of posts and still can’t figure it out. Here is my code: # MOVIE RATING(S)
movies = {
Madagasgar_3: 4,
Home: 3,
Shaun_The_Sheep_The_Movie: 2
}
puts "Night at the movies"
choice = gets.chomp
case choice
when "add"
puts "Enter a Title"
title = gets.chomp
movies[title]
when "update"
puts"Enter a rating"
rating = gets.chomp
movies[title] = rating
when "delete"
puts "Deleted!"
else puts”Error!"
end
`
Please help.


#2

HI you are at Lesson 4 promoting redux so your code when you arrived was like that?

choice = gets.chomp

case choice
    when "add"
        puts "Added!"
    when "update"
        puts "Updated!"
    when "display"
        puts "Movies!"
    when "delete"
        puts "Deleted!"
    else
        puts "Error!"
end

#3

Then they aske you to..

1 Inside your when "add" block, remove the puts "Added!" statement.

when "add"
    puts "Added!"

2 In its place, prompt the user for a movie title. Save the result in a new variable called title. (*Your code already has an example of how to do this!)

when "add"
    puts "Here goes your masage"
    title = gets.chomp

then they aske you to do the same for the rating of the movie.
then under the titlle gets.chom they akse you to do this

4 Add that movie/rating pair to the movies hash and puts a message indicating the pair was added. (No need for to_sym or to_i just yet!)

movies[title] = rating

#5

I figured it out my self I Just needed to add: movies[title] = movies and movies = {}
movies[title] = rating