Skip to content

Answer is incorrect #65

Description

@ncaron

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions