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 trial

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)