4. Prompting: Redux!


#1

Hello! Whats wrong in code:

movies = { Revolver: 5,
From_the_Paris_with_love: 4.9,
Cable_guy: 5}

puts "What do you want?"

choice = gets.chomp

case choice

when "add"
puts "Insert movie title:"
title = gets.chomp
puts "Insert rating:"
rating = gets.chomp
movies (title) = rating
puts "Your movie and rating has added"

when "update"
puts "Updated!"

when "display"
puts "Movies!"

when "delete"
puts "Deleted!"

else
puts "Error!"
end


(ruby):15: syntax error, unexpected '=', expecting keyword_end
movies (title) = rating
^
(ruby):18: syntax error, unexpected keyword_when, expecting $end
when "update"

Oops, try again. Did you create a variable called title?


#2

Make sure you're using the correct syntax for adding to the movies hash on this line:

movies (title) = rating

#3

Thank u very much! Already check it)
Thanx!)


#4

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