Ruby Ruby Collections Ruby Hashes Working with Hash Values

Adrian Filimon
PRO
Adrian Filimon
Pro Student 6,668 Points

It looks like Task 1 is no longer passing.

Nothing to add, i don't understand why the if is in conflict with the new created array

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

1 Answer

Sam Donald
Sam Donald
36,301 Points

It's .values_at()

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

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