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 2.0 Collections and Control Flow Dictionaries Working with Dictionaries

what am i doing wrong?

??

dictionary.swift
// Enter your code below

var iceCream = [

      "CC": "Choclate Chip",
      "AP": "Apple Pie",
      "PB": "Peanut Butter"

]

12 Answers

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

It's like getting an item from an array, accept it is the kay, not the index:

let applePie = iceCream["AP"]
Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points
iceCream.updateValue("Chocolate Chip Cookie Dough", forKey: "CC")

you sure that's right? because that's not working

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

This is what I used to pass the first task:

var iceCream = [
  "CC": "Chocolate Chip",
  "AP": "Apple Pie",
  "PB": "Peanut Butter"
]

yes but the next task?

yes but the next task?

no i mean the third*

no i mean the third*

and the last?

Thanks i found tha last one out by my self but thanks for the help now i get it

i asking you to be active to help me out more if i need it

i gave you some best answer