Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Stuck in Dictionaries
I'm stuck in the test part of dictionaries. I rewatched the videos and had notes to help me remember the lecture, but i cant seem to get the answer here although i followed what the professor told me to do.
"Let's pretend a customer has ordered an ice cream. Retrieve the value for apple pie using the correct key and assign it to a constant named applePie."
Thanks in advance! :)
// Enter your code below var iceCream = ["CC": "Chocolate Chip", "AP": "Apple Pie", "PB": "Peanut Butter"] iceCream.updateValue("Rocky Road", forKey: "RR") iceCream["AP"] let applePie = iceCream["AP"]
Hi Ronie, I dont think youre as "stuck" as you think you are. You made it to part 3 of the challenge! good job!
Everything is right with you code except where you inserted iceCream["AP"] above the applePie constant. Was there a reason you added this?
Stuart Wright41,101 Points
You just need to delete:
Your next line is correct.
The line that you're deleting would be fine in Playground if you just want to see what the value of iceCream["AP"] is, but you would never use it in a real program, and it's what causes the following error in the code challenge:
swift_lint.swift:23:9: error: expression resolves to an unused l-value iceCream["AP"] ~~~~~~~~^~~~~~