I need help understanding a Ruby method

It was my understand that

.nil?

Is method to use to see if an object is empty or not in Ruby. How is it, that it is used to check if the movie has already been added in the program code that can be found through the link below?

Ruby Code

movies[title] is going to return the rating of the movie with that specific title. But if it so happens that that title is not in the movies hash, then it will return nil because the record does not exist.

1 Like