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 trialJennifer Hsueh
648 Pointswhy is task 1 no longer passing?
I haven't changed any of my code for task 1, so why is it not passing now?
grocery_item = { "item" => "Bread", "quantity" => 1, "brand" => "Treehouse Bread Company" }
grocery_item.has_value?("Bread")
grocery_item.store("food", true)
grocery_item.values_at("item")
grocery_list = {"item")
3 Answers
Antonio De Rose
20,885 Pointsgrocery_item = { "item" => "Bread", "quantity" => 1, "brand" => "Treehouse Bread Company" }
grocery_item.has_value?("Bread") #this line is correct, again it is to check with a condition, so where is "if"
grocery_item.store("food", true) #this line is correct
#in ruby, if you start with if, you should end, it with "end"
grocery_item.values_at("item") #take off this line, question have not asked you to do it
grocery_list = {"item") #take off this line too
Jennifer Hsueh
648 Pointssorry, you said: #in ruby, if you start with if, you should end, it with "end" why do i need an if and end here?
and the last 2 lines are for the 2nd task. i've completed it now, but it seems strange to me that the 2nd task asks: "Use the values_at method on the grocery_item hash to get an array consisting of a single value: the value of the "item" key. Store the returned array in a variable named grocery_list."
and i can completely this task using:
grocery_item.values_at("bread") grocery_list = ["Bread"]
OR
grocery_item.values_at("item") grocery_list = ["Bread"]
mazen akkari
19,861 PointsI also got confused, it's the way the question is asked. Thanks for the help Jennifer
Antonio De Rose
20,885 Pointssure, send me the code, with the screenshot, to see, what you have tried.