Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Swift Enums and Structs Enums What is an Enum?

Will Feldman
Will Feldman
3,121 Points

When every you are using a enum can you do the .value

Even when you reassigning the var today to Day.Sunday could you have just done this?

today = .Sunday

Because you have already declared that it is the enum Day?

No this will not work .Value syntax being used because here the
func weekdayOrWeekend ( dayOfWeek: Day ) ->String{} is stated in
func (parameter :Type){} allowing inner switch case can use .Value of enum as it is expecting Day.Value .... So ```enum Day{ case Value, OtherValue } func ( param : Day)-> String{
switch param{ case .Value: return "string yes" default: return "string no" }
}

Look at your **return values** they must be **->String** so variable will not be suitable