Skip to content

Instantly share code, notes, and snippets.

@hartbit
Created June 11, 2014 14:41
Show Gist options
  • Save hartbit/50cea01c4f70649cf89a to your computer and use it in GitHub Desktop.
Save hartbit/50cea01c4f70649cf89a to your computer and use it in GitHub Desktop.
let yetAnotherPoint = (1, -1)
switch yetAnotherPoint {
case let (x, y) where x == y:
println("(\(x), \(y)) is on the line x == y")
case let (x, y) where x == -y:
println("(\(x), \(y)) is on the line x == -y")
case let (x, y):
println("(\(x), \(y)) is just some arbitrary point")
}
// prints "(1, -1) is on the line x == -y"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment