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 trialKhambrel Davis
24,572 PointsWhat in tarnations could be wrong with my code? Enumerations and Optionals!
enum Compass: Int { case North = 1 case South = 2 case East = 3 case West = 4 }
if let Direction = Compass(rawValue: 2) {}
1 Answer
Marina Alenskaja
9,320 PointsHi :-)
You don't need to use if let to declare a constant. Furthermore, the challenge has an error: you can only pass by naming the constant "direction" without capital D...
enum Compass: Int {
case North = 1
case South = 2
case East = 3
case West = 4
}
let direction = Compass(rawValue: 2)