Lesson 9 question


#1

OK, so I got stuck for hours on lesson 9 and couldn't figure out what i was doing wrong. So I finally decided to "cheat" to find out what I was doing wrong. So the part I was messing up on was the movies.delete(title.to_sym) part. I had the brackets [], while I was suppose to be using the parenthesis. Can someone explain why I use parenthesis on the else statement instead of brackets?

`when 'delete'
  puts "What movie do you want to delete?"
  title = gets.chomp
  if movies[title.to_sym].nil?
    puts "Movie not found!"
  else
    movies.delete(title.to_sym)
    puts "#{title} has been removed."
  end`

#2

Hi @deadendstreet,

Hint: movies.delete is a method. You have to put parenthesis to call a method. Brackets are used to access elements from arrays and objects.


#3

actually in my case when i remove puts"delete" its showing the same result -nil-.........why is it so?