Welcome to the Treehouse Community
Looking to learn something new?
Is this the right syntax for a dictionary, It is not working in the playground so I have no idea what I'm doing wrong.
// Enter your code below let iceCream = [ "CC": "Chocolate Chip" "AP": "Apple Pie" "PB": "Peanut Butter" ]
Cindy is right, you have to use var instead of let, because that's what the challenge wanted you to do. But that's not what is wrong with your syntax. You can use a var or a let to declare a dictionary, depending on your needs.
When declaring a dictionary you want to use the [ ] brackets. Inside the brackets, you have to give them keys and values, separating the key and the value with colons : once you've done that, you have to separate them with commas, that's where your code was wrong.
// Proper declaration of a dictionary. let airports: String = [ "LGA": "La Guardia", // Comma separation "MIA":"Miami Airport", "LAX":"Los Angeles Airport" ] // Accessing the values let miamiInternational = airports["MIA"]
Cindy LeaCourses Plus Student 6,485 Points
// Enter your code below
var iceCream = ["CC": "Chocolate Chip", "AP": "Apple Pie", "PB": "Peanut Butter"]
You need to use var, not let