Ruby Ruby Collections Ruby Hashes Working with Hash Values

Katherine Ward
Katherine Ward
4,143 Points

Using Hash Keys

Really stumped at this questions...any hints

hash.rb
grocery_item = { "item" => "Bread", "quantity" => 1, "brand" => "Treehouse Bread Company" }
if grocery_item.has_value?("Bread")
  grocery_item.store("food", true)

grocery_item.values_at("item") = grocery_list[]
end 
end 

1 Answer

Angela Visnesky
Angela Visnesky
20,924 Points

Hi Katherine!

grocery_item = { "item" => "Bread", "quantity" => 1, "brand" => "Treehouse Bread Company" }

if grocery_item.has_value? ("Bread")
  grocery_item["food"] = true
end

This should put you on the path to completing the challenge. I hope this helps!