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 trialJason Tzannes
1,194 PointsWhat am I doing wrong?
What am I doing wrong other than naming a variable x? I get no output and have no idea what is wrong.
class Temperature {
var celsius: Float
var x: Float {
return (celsius * 1.8) + 32
}
init(celsius: Float) {
self.celsius = celsius
}
}
let fahrenheit = Temperature(celsius: 0.0)
fahrenheit.x
1 Answer
frezy stone
3,658 Points'''html<p> Hey jason, in the challenge they want you to name the computed property as "fahrenheit" and not "x". Despite the fact that your code is correct, the computer will let you go on if you only follow the instructions. This is how your code should look:class Temperature { var celsius: Float var x: Float { return (celsius * 1.8) + 32 } }</p>'''
Grady Newman
4,729 PointsGrady Newman
4,729 PointsHi Jason,
I just copied your code into a playground and am showing 32 as the return from the Temperature class. There should not be any output in your console output in your assistant editor, as you are calling the println() or other similar function.