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 trialAnthony Smith
311 Pointsunable to solve challenge task 2.2 Dictionary.
I give... I understand my attempt will not work because currencies is a constant. The only other answer I can think of is let ukCurrency = ["UK": "Pound"] This didn't work either I guess because "UK" is already used. Is there a way to change a constant to a variable?
let currencies = ["US": "Dollar" , "UK": "Pound" , "JP": "Yen"]
let ukCurrency = currencies.RemoveValueForKey("UK")
1 Answer
landonferrier
25,097 PointsAnthony, it seems that you have just used the wrong method to retrieve the value for the key.
Swift:
let ukCurrency = currencies["UK"]
Objective C:
NSString *ukCurrency = [currencies objectForKey:@"UK"];
Remember, in Objective-C you will need to use the method (objectForKey) to access a value given the key.
If you have any questions, feel free to ask!