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 Swift Types Mixed Types

What is the solution? Can't pass this easy task..

What is the right code for this task?

// Enter your code below
var rating = 7.5

2 Answers

Did you delete the code of the first task? The task with the var rating is correctly solved, what I'm missing is the constant with the name of the book first. My solution (including task 3) is:

// Enter your code below
let title = "A Dance with Dragons"
var rating = 7.5
var isAvailable = false
28,558 Points

The code you have is correct for task 2, but remember that you are meant to keep the code for each task as you progress through the challenge. It looks like you have removed the code you wrote for the first task, which is why your solution is not accepted.

If you add the code from task 1 back like this:

let title =  "A Dance with Dragons"
var rating = 7.5

Then you'll be able to pass to task 3.