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 trialRobert Sheppard
2,549 PointsHow is the below data type an optional? let today = Day(rawValue: 1)
How is the constant today as defined above an optional? If enums make their own datatypes wouldn't Day be the datatype?
Brian Tufts
1,755 PointsBrian Tufts
1,755 PointsYes, it is it's own datatype, however you still have to "unwrap" the variable. If you look in your results pane, it says "enum value" instead of the actual value. This means that it is an optional. It is an optional because Swift doesn't know if the raw value of 1 is actually in the enum.