4. Prompting: Redux!


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!"

puts "Error!"

(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?


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

movies (title) = rating


Thank u very much! Already check it)


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