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

is 9.99 not a double?

i was asked to create a constant 'price' and and give a value of 9.99 but when i did it i was told that 9.99 is supposed to be a double but it isn't and an example of a double is 6.99. i really didn't understand the question i need some help

numbers.swift
let title = "A Dance with Dragons"
let price = "9.99."

2 Answers

Nathan Tallack
Nathan Tallack
22,160 Points

9.99 could also be a Float. ;)

But in your case you putting it inside of the quotes makes it a String.

Try:

let price: Double = 9.99

thanks chap it worked