Created
December 12, 2016 21:57
-
-
Save isoiphone/8fcb9b0e5fa1662774c7179150c5f678 to your computer and use it in GitHub Desktop.
Using one switch statement with multiple lines in each case
This file contains hidden or 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
class OneBigSwitchExample { | |
enum Type { case First, Second } | |
var magic: String = "" | |
var cool: String = "" | |
var fast: Bool = false | |
func foo(type: Type) { | |
switch type { | |
case .First: | |
magic = "dark" | |
cool = "super" | |
fast = true | |
case .Second: | |
magic = "light" | |
cool = "super-duper" | |
fast = false | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment