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?

Josh Bradford
Josh Bradford
9,935 Points

Can't figure out why I am not getting this code right, can anyone help? I am suppose to assign value for key to constant

I believe I have the code correct but it is not passing me through. It keeps giving errors. Has anyone had this same problem? Any help would be great, thanks in advance.

let currencies = ["US": "Dollar", "UK": "Pound", "JP": "Yen"]
let ukCurrency = currencies.removeValueForKey("UK")

1 Answer

Josh Bradford
Josh Bradford
9,935 Points

It worked like a charm, man, thank you so much for the help!

Just like you said. When retrieving a value from a dictionary, use this example: ``` let greeting: String = ["Hello": "Formal", "Hey": "Irrformal"] let formal: String = greeting["hello"]