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 trialCarl Smith
8,185 PointsThis still is not working. Trying to create a hash if the statement is true.
Not sure what I'm doing wrong.
grocery_item = { "item" => "Bread", "quantity" => 1, "brand" => "Treehouse Bread Company" }
if grocery_item.has_key?("Bread")
groery_item["food"] = true
end
1 Answer
Jennifer Nordell
Treehouse TeacherIt asks you to use the has_value? method. Not the has_key? method. Try simply repacing the has_key? with has_value? Hope that helps!
Carl Smith
8,185 PointsCarl Smith
8,185 PointsHaha I've been so irritated with this and it was that simple. No idea how I kept missing that. Thank you sooo much!
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherWell, to be honest it's almost never the giant logic flaws that are the problem. It's the missing quote or the misspelled variable. Sometimes it's just nice to have an extra set of eyes :) But, you're quite welcome!
Carl Smith
8,185 PointsCarl Smith
8,185 PointsYes, definitely, I also noticed I misspelled "grocery" . Either the way it now works, thanks to your help.