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 Basics An Introduction to Swift Programming Working With Constants

I don't know how to solve these.

Not sure what I did wrong.

constants.swift
// Enter your code below
let language = "favDessert"
var str = "favDessert"
str = "Pie"

3 Answers

David Montalvo
David Montalvo
6,937 Points

Sorry but I don't get it... Please can you write the complete question so I can help you, because the challenge is asking for one task, but you are doing another one,

The instructions are: "Create a constant named favDessert and assign to it a string containing your favorite dessert. "

let favDessert = "favDessert"

Here favDessert is the constant they asked you to create, and "favDessert" is the string containing your favorite dessert that is being assigned to it.

David Montalvo
David Montalvo
6,937 Points

Ok. your code is right, maybe try to change the "favDessert" to another one "IceCream" for example, so your code should be something like this:

let favDessert = "IceCream"

That works for me :)

Sure. You had "favDesert" so I just stuck with it. It doesn't matter, as anything inside double-quotes is a String. The editor would have accepted "xyxyxy"