Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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"