Last active
January 14, 2018 19:01
-
-
Save agoiabel/617db4b943a984e6f2dea0d2ce2fdfed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
enum Day { | |
case Sunday | |
case Monday | |
case Tuesday | |
case Wednessday | |
case Thursday | |
case Friday | |
case Saturday | |
} | |
/** Rewriting the date type function */ | |
func dayType(for day: Day) { | |
switch day { | |
case Day.Saturday, Day.Sunday: | |
return "Weekend" | |
case Day.Monday, Day.Tuesday, Day.Wednessday, Day.Thursday, Day.Friday | |
return "Weekday" | |
} | |
} | |
let result1 = dayType(for: Day.Sunday) //will return "Weekend" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment