-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Description
http://www.codequizzes.com/ruby/beginner/symbols-array-methods-hashes
What does the following code return?
snowy_owl = { "type"=>"Bird", "type" => "Owl", "diet"=>"Carnivore", "life_span"=>"10 years" }
puts snowy_owl
Answer
{"type"=>"Owl", "diet"=>"Carnivore", "life_span"=>"10 years"}
Notice that the second key/value pair with the key "type" is included. Every key in a hash must be unique.
But puts always returns nil. So the answer on the site is incorrect or it should be asking what does it print.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels