movies = {
tron: 4,
jaws: 3,
inception: 5
}
puts "Enter a choice ('add', 'update', 'display', 'delete'):"
choice = gets.chomp.downcase
#puts choice
case choice
when 'add'
puts "Enter the movie title you'ld like to add:"
title = gets.chomp
puts "Enter the movie's rating:"
rating = gets.chomp
movies[title] = rating
#test
puts movies
puts "Movie title and rating has been added!"
when 'update'
puts "Updated!"
when 'display'
puts "Movies!"
when 'delete'
puts "Deleted!"
else
puts "Error!"
end
Thank you, the "movies[title] = rating" really saved me :)
ReplyDelete