天天看點

Swift關鍵字where

where : 用于條件判斷

let point = (1, -1)  
switch point {  
case let (x, y) where x == y:  
    print("x == y")
case let (x, y) where x > y:  
    print("x > y")
case let (x, y) where x < y:  
    print("x < y")