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 trialHector Lopez
1,477 PointsI have no idea what is supposed to be returned in my switch statement to get the x or y coordinate to move.
I think I have everything in order except the part where I need to return something in each case. I've tried Point(x:0, y:0) and I get non-void return value in void function.
2 Answers
Brendan Whiting
Front End Web Development Techdegree Graduate 84,738 PointsA robot has a property called location which is an instance of Point, which will mean that location has an x and a y property. The important thing to note is that you don't modify properties of Point, you modify properties of location.
switch direction {
case .Up: location.y++
case .Down: location.y--
case .Right: location.x++
case .Left: location.x--
}
Hector Lopez
1,477 PointsThanks!