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.

iOS Swift Basics (retired) Collections What is a Dictionary?

Cannot Assign the value for key "UK" to a constant named ukCurrency.

As the title says, I am having trouble assigning the value "UK" to a constant named "ukCurrency". Here are the lines of code I have tried:

currencies["UK"] = "ukCurrency"

and

currencies.removeValueForKey("UK": "ukCurrency)

Thanks in advance!

dictionaries.swift
let currencies = ["US": "Dollar", "UK": "Pound", "JP": "Yen"]
currencies["UK"] = "ukCurrency"

3 Answers

Logan R
Logan R
22,989 Points

I would check out William Lee 's answer for a good explanation here:

https://teamtreehouse.com/forum/not-sure-why

Thanks man! I actually just figured it out from a similar post about five minutes ago. I think I understand it now.

QA;TL?

Logan R
Logan R
22,989 Points

Not sure what QA;TL means, lol.

QA;TL stands for "Question Answered, Thread Locked"

It's used a lot on other forums so I assumed y'all would know about it.

Logan R
Logan R
22,989 Points

Ah okay. (I'm not very hip lol)