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 trialCharlie Maréchal
7,001 PointsHey ! I was doing great but I'm stuck here, it keeps saying my code could not be compiled :( But Xcode runs it...
What am I doing wrong ?
class Button {
var width: Double = 0.0
var height: Double = 0.0
var points: Double = 0.0
init(width:Double, height:Double, points:Double){
self.width = width
self.height = height
self.points = points
}
func incrementBy(points: Double) -> (width: Double, height: Double) {
return ((width + points), (height + points))
}
}
Charlie Maréchal
7,001 PointsCharlie Maréchal
7,001 PointsOk, I kept trying and finally got it. For those who might be interested, I was going the wrong way by trying to return a value. A simple change to the width and height variable in the method was way enough to do the job !