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?

Tim Scarafiotti
Tim Scarafiotti
284 Points

Struggling with this one. When I use let ukCurrency = UK, the Xcode program will run it fine, but tutorial says no go.

Struggling with this one. When I use let ukCurrency = UK, the Xcode program will run it fine, but tutorial says no go.

dictionaries.swift
let currencies = ["US":"Dollar","UK":"Pound", "JP":"Yen"]

let ukCurrency = UK

1 Answer

Roberto Alicata
PLUS
Roberto Alicata
Courses Plus Student 39,959 Points

in the second line you simply assign a value of UK to ukCurrency, but the challenge ask to get the right value of the "UK" key of the currencies array.

this is the right code:

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

let ukCurrency = currencies["UK"]