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?

Dictionaries Challenge Var vs. Let

There seems to be a problem with this challenge and I can't get past it. To complete the first part I have to create a constant called currencies. Then I have to change that immutable dictionary in the second part. This is not possible as far as I can tell.

Is it me? or is this challenge messed up.

Thanks, -Andrew

dictionaries.swift
var currencies = ["US": "Dollar", "UK": "Pound", "JP": "Yen"]
let ukCurrencies = currencies.removeValueForKey("UK")

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi Andrew,

This challenge has caught you and other students off guard but I still think it's due to a misunderstanding of what the keyword "assign" means.

In any case the challenge wants you retrieve the value for the key UK and assign it to a new constant called ukCurrency.

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

Happy coding!

Hey Chris, Thanks!

By the way, I'm looking for a good coder as I'm learning to create an app I have in the works. I have investors lined up and a prototype created in Titanium but I need a proper, natively coded, reliable version to move forward. Do you know anyone who would be interested?

Thanks again for you assistance, -Andrew

Chris Shaw
Chris Shaw
26,676 Points

No worries, I'm in Australia so I don't have many contacts outside but one company whom I've worked with are Two Bulls who are professional app developers but come at a price, might be worth just calling or sending them an email.