Created
November 16, 2015 16:41
-
-
Save jarsen/8e477bf47ac71ed88e99 to your computer and use it in GitHub Desktop.
This file contains 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
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