Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAndrew Ackerman
8,347 PointsNeeding help with Hash Values.
Hi, I'm to entirely sure where I'm going wrong here. I'm very sure i've used a similar code before to do the same but for Hash Keys, I'm really appreciate some direction as to what I'm doing wrong.
Thank you in advance!
grocery_item = { "item" => "Bread", "quantity" => 1, "brand" => "Treehouse Bread Company" }
if hash.has_value?("bread")
hash.store("food", true)
end
2 Answers
Jean Malan
10,781 PointsIf hash.has_value?(βBreadβ)
Make sure your bread has a capitalized B as it is case sensitive.
Andrew Ackerman
8,347 PointsThank you!
Andrew Ackerman
8,347 PointsAndrew Ackerman
8,347 PointsI realise now that my hash was incorrectly named and should in fact be "grocery_list", but the rest is still not working.