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 trialRaphael Reiter
6,820 Pointsenums with raw values code challenge
enum Compass: Int { case north = 4 case south = 1 case east = 2 case west = 3 }
let direction = Compass.south.rawValue
Heres my code, works on xCode ... What's wrong with it? Thanks
enum Compass: Int {
case north = 4
case south = 1
case east = 2
case west = 3
}
let direction = Compass.south.rawValue
3 Answers
David Papandrew
8,386 PointsTry something like this:
enum Compass: Int {
case north = 1
case south
case east
case west
}
let direction = Compass(rawValue: 1)
Harold Sweat
Courses Plus Student 7,407 PointsI had Raphael's same answer to this question and it did not pass. I also copied David's code in and that didn't pass either.
Raphael Reiter
6,820 PointsThanks David :)