Ruby Ruby Collections Ruby Hashes Working with Hash Keys

Basto Biih
Basto Biih
5,334 Points

Not understanding how to complete this can anyone help?

Can anyone help me with this?

hash = { "name" => "Bread", "quantity" => 1, "calories" => 100 }
food = {"food" => "true"}

1 Answer

This challenge is a little confusing in its wording, but what you are expected to do is set the result of the has_key? method on the hash variable (not the Hash class as you have done) to a second variable called "food".

food = hash.has_key?("calories")