swift switch tuple where

来源:互联网 发布:linux ftp 断点续传 编辑:程序博客网 时间:2024/06/03 06:43



let anotherPoint = (2,0)

switch anotherPoint {

     case (let x , 0) where x = (y +2):

             print("on the x-axis with an x value of \(x)")

     case (0 , let y):

             print("on the y-axis with an y value of \(x)")

     case(let x, let y):

             print("somewhere else at (\(x),\(y))")

}

0 0
原创粉丝点击