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.

I get an error

When defining the constant areaInMeters I get the error "Type 'int' does not conform to protocol 'FloatLiteralConvertible". The console output is "Playground execution failed: <EXPR>:18:27: error: type 'Int' does not conform to protocol 'FloatLiteralConvertible' let areaInMeters = area / 10.764"

Try writing

let (or var) area: Double = xxx

or

let areaInMeters = Double(area)/10.764

Your problem is that "area" is being type inferred as Int. Anyway, you shouldn't be getting an error, it should just return an Int value. Would it be possible for you to share your code? :)

Hope that helps!

Hi,

i get why this is happening but in the "Swift Basics Course" at the "Binary Operators" video tutorial it seems to work. Actually the division " area / 10.764 " gives a result of 12 even though area is an int. When I try that in Xcode 6.1 I get the error I mentioned. My code is:

// Playground - noun: a place where people can play

import UIKit

let height = 12 //feet let width = 10 // feet

let area = height * width //sq. feet

let areaInMeters = area / 10.764 //sq. meters

Hi Fotios, I am not sure what your code contains but it says you are mixing up integers with float. Is the variable area an integer while 10.746 you are trying to divide it with a float? Try checking out the type of the variables you are working on.

It seems that in video, he was able to mix integers and floats, but in current version of xCode, you cant do that, so in order to fix this bug, you just need to define first constants as double and it will work.

This helped me get past this step. Assigning the first two as double.

I get the same error at Fotios. The code I was entering was exactly the same as in the video. When I set each of the variables to be Double, it works. But without doing that I get the same error. I wonder if it's a different version of Xcode?

Yes, same issue here. I agree. It seems to be related to the version of Xcode we are using. I am using 6.1.

I just changed all my constants to : Double and that fixed the issue. Running version 6.1 so appears to be a new error being called out that wasn't in 6.0.

Hey, It looks like he just had a different version of xCode because I get the same error. While doing Treehouse, Im also getting my Bachelors in Mobile Development. What we learned, was to always put the TYPE with your Variable or Constant. It's good practice and reduces errors like this.