Skip to content

Instantly share code, notes, and snippets.

@jarsen
Created Nov 16, 2015
Embed
What would you like to do?
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