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 trialMatt Conway
1,572 PointsRating
/Users/mattconway/Desktop/Screen Shot 2016-01-07 at 11.45.18 AM.png
Don't understand this section, trying to rate a book. Not working for me. I also do not understand why the codes change colors, how can I find out what each color mean? There is red, yellow, purple, light blue, and white.
// Enter your code below
let title = "A Dance with Dragons"
var = "rating"
"\(title) \(rating) is \(7.5)"
2 Answers
Steven Deutsch
21,046 PointsHey Matt Conway,
The multiple colors on the code help you differentiate between the different parts of the code. The green is used on the comments, the pink indicates a string, the orange indicates a keyword var or let, and the white is the variable or constant name. These colors can be different from what you see in your playgrounds.
As for the question, this is an easy one. You're just over thinking it. You need to create a variable called rating and assign it the value of 7.5.
var rating = 7.5
Good Luck!
Black Ops
512 PointsI did same here but not working for me!
alexander aceves
Courses Plus Student 172 Points1) let title = "a dance with dragons" 2) var rating = 7.5
Matt Conway
1,572 PointsMatt Conway
1,572 PointsHere is the instructions for this:
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