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

Michael Sarpong
Michael Sarpong
478 Points

Declare a variable : let title = "A dance with dragons" var rating = "7.5" still getting error on coder

i know i'm right.....

types.swift
let title = "A dance with dragons"
var rating = "7.5"

2 Answers

Anthony Lafont
Anthony Lafont
17,075 Points

Hi Michael,

If you put quotation marks for your variable "rating", it means you want to store the value as a String. In the code challenge, they want the rating to be stored as a Double. To pass it, you just have to give up the quotation marks.

Here is the code:

let title = "A dance with dragons"
var rating = 7.5
Michael Sarpong
Michael Sarpong
478 Points

Thanks you for the super quick reply So much to learn!

???