Ruby Ruby Collections Ruby Hashes Working with Hash Values

Peter Boyden
Peter Boyden
2,005 Points

I don't entirely understand what is being asked in these tasks for hash's. Can you send me the solution so I can see?


grocery_item = { "item" => "Bread", "quantity" => 1, "brand" => "Treehouse Bread Company" }
grocery_item["food"] = "True"
Zans Litinskis
Zans Litinskis
2,049 Points

Do you find your mistake? If not please look closer to your

grocery_item["food"] = "True"
irb(main):001:0> grocery_item={"item"=>"Bread","quantity"=>1,"brand"=>"Treehouse Bread Company"}                                                                                                                      
=> {"item"=>"Bread", "quantity"=>1, "brand"=>"Treehouse Bread Company"}                                                                                                                                               
irb(main):002:0> grocery_item.has_value?("Bread")                                                                                                                                                                     
=> true                                                                                                                                                                                                               
irb(main):003:0> grocery_item["food"]=="True" 
=> false