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 Functions and Optionals Parameters and Tuples Decomposing a Tuple

Yupin Hu
Yupin Hu
3,702 Points

Creating a dictionary with multiply keys?

not very sure if i understood it wrong. When the extra credit at the end of this video is asking to create a dictionary with three keys: title, artist, album. how exactly to make that work.. I know for a dictionary there is a key and value in the syntax of key:Value

Thanks in advance!

1 Answer

Tarek Borhan El-Din
Tarek Borhan El-Din
4,229 Points

Hello Yupin,

I hope I can help you with your problem. When you create a dictionary, you assign a value to every key you have inside your dictionary. You can add as many keys inside your dictionary as you want. So, for example, let's create a dictionary called musicDictionary.

var musicDictionary = ["title": "Legend", "artist": "Drake", "album": "If You're Reading This It's Too Late"]

I hope I could help you understand the syntax. Feel free to ask if you got any further questions.