Skip to content

Instantly share code, notes, and snippets.

@gregomni
Created February 21, 2016 02:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gregomni/cfaef124bd943168f266 to your computer and use it in GitHub Desktop.
Save gregomni/cfaef124bd943168f266 to your computer and use it in GitHub Desktop.
enum Foo {
case A(String, Int)
case B(Int, String, String)
case C(Int)
}
func thingy(arg: Foo) -> String {
var r: String
switch(arg) {
case .A(let s, let i), .B(let i, _, let s):
r = "\(s)\(i)"
case .C:
r = "c"
}
return r
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment