Skip to content

Instantly share code, notes, and snippets.

@jarsen
Created November 16, 2015 16:41
Show Gist options
  • Save jarsen/8e477bf47ac71ed88e99 to your computer and use it in GitHub Desktop.
Save jarsen/8e477bf47ac71ed88e99 to your computer and use it in GitHub Desktop.
import UIKit
enum MyError: ErrorType {
case Oooggh(String)
}
func errorProne() throws {
throw MyError.Oooggh("nope")
}
do {
try errorProne()
} catch MyError.Oooggh("agree") {
// not match "agree" != "nope"
} catch MyError.Oooggh("nope") {
print("nope")
}
var value = (1,2)
switch value {
case let (1, y):
// match 1
break
case let (x, y) where x / 5 == 1:
// not-match
break
default:
break
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment