Using Hash.new


#1


https://www.codecademy.com/en/courses/ruby-beginner-en-F3loB/1/2?curriculum_id=5059f8619189a5000201fbcb

the error message says that i haven't declared a variable called pets.
please help.


my_array ={ "pets" = Hash.new }


#2

(repl):1: syntax error, unexpected '=', expecting =>
my_array ={ "pets" = Hash.new }
                    ^
(repl):1: syntax error, unexpected '}', expecting end-of-input
my_array ={ "pets" = Hash.new }
                               ^

There are two errors, here. But the one that is not mentioned is the extra structure. The instructions ask for a hash with the name, "pets". Let's just remove that and let you sort out the other error mentioned above.

"pets" = Hash.new

#3

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