Skip to content

Instantly share code, notes, and snippets.



Last active Jun 6, 2016
What would you like to do?
func checkAll<T1, T2, T3>(clauses: (T1?, T2?, T3?)) -> (T1, T2, T3)? {
guard let one = clauses.0 else {
print("1st clause is nil")
return nil
guard let two = clauses.1 else {
print("2nd clause is nil")
return nil
guard let three = clauses.2 else {
print("3rd clause is nil")
return nil
return (one, two, three)
let a: Int? = 0
let b: Int? = nil
let c: Int? = 3
guard let (d, e, f) = checkAll((a, b, c)) else {
print("a: \(d)")
print("b: \(e)")
print("c: \(f)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.