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 Basics (retired) Types Numbers

how to create a constant called price and assign it the value 9.99

Need help

Edwin Capel
Edwin Capel
2,232 Points

assuming you're learning the Swift language

constants are defined by "let"

so for your question :

let price = 9.99

Thanks Ed, That's what I thought but it's not working. I've contacted support

6 Answers

It would be ...

let price = 9.99

Thank you. Thats what I thought but it doesn't work.

Jabran Shakil
Jabran Shakil
2,734 Points

Hi Aaron, I figured it out. I forgot to remove the colon which isn't necessary when defining numbers I guess. Thank you.

Brendan make sure you have the first answer listed on the challenge as well. Your answer should look like this:

let title = "A Dance with Dragons"

let price = 9.99
Jabran Shakil
Jabran Shakil
2,734 Points

I'm getting the same exact stupid error. I have everything typed out exactly like you have it. I thought I was doing it right, and I am but the thing keeps saying Somethings not right. Is it because I'm doing this code challenge on the teamtreehouse app? This is getting frustrating, I always have these problems with the treehouse editor.

Jabran Shakil
Jabran Shakil
2,734 Points

Any help here? It won't let me move into the next part of the code challenge. Thank you.

Hello Jabran, can you show me your code please?