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 trialTodd Volmari
4,959 PointsWhat I doing wrong here...?
It is asking me to do this: "Letβs assume we want to create a model to represent a box of chocolates. The chocolate box will contain dictionary instances that stores information about different kinds of chocolates. To start, create a struct named ChocolateBox."
My code is attached, what am I doing wrong? Thanks
struct ChocolateBox {
var flavor: String
}
let caramelDelight = ChocolateBox(flavor: "caramel")
1 Answer
Chris Stromberg
Courses Plus Student 13,389 PointsFor the first part of the challenge you only have to make a struct with no properties.
struct ChocolateBox { }
For the second part of the challenge you add the stored property. Which is a dictionary called caramelDelight and has a key value pair of flavor and caramel.
struct ChocolateBox {
var caramelDelight = ["flavor" : "caramel"]
}