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
Taran Khatwani
172 Pointshelp please
Question:
every book in our store has a rating so that customers can sort through selections. In this task, declare a variable named rating and assign the value 7.5
Code:
let title = "A Dance with Dragons"
var rating = "7.5"
doesnt work...
help please
1 Answer
Jennifer Nordell
Treehouse TeacherHi there! Take a look again. You're assigning the string value "7.5" instead of the numerical value 7.5. Try it again without the quotation marks
Agon Hasani
2,967 PointsAgon Hasani
2,967 PointsThe answer is:
var rating: Double = 7.5;
P.S Don't forget to add the colon sign ":", behind var name (in this case "rating"), then declare the type of the variable (in this case the "Double" variable), and then add a value (in this case "7.5"), so be sure you add a semicolon sign ";" behind that value. Hope this was helpful. All the best,