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 trialJosh Schlabach
1,771 PointsI'm trying out the 2nd dictionary challenge but this pops up in the output:
swift_lint.swift:4:18: error: immutable value of type '[String : String]' only has mutating members named 'removeValueForKey' let ukCurrency = currencies.removeValueForKey("UK")
1 Answer
johanneseichler
6,514 PointsIf I have seen this correctly you are asked to assign the value of the key "UK" to the constant. But you tried to assign the value to the constant and remove it. As "currencies" is a constant (created with "let") it is immutable and you cannot remove any values.
The correct way to assign a value from a dictionary is
nameOfTheDictionary[key]
in this case
ukCurrency = currencies["UK"]