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