var coordinate = (1,1) switch coordinate { case (0,0): println("It's at origin!") case (1,0): println("It's an unit vector on the positive x-axis.") case (-1,0): println("It's an unit vector on the negative x-axis.") case (0,1): println("It's an unit vector on the positive y-axis.") case (0,-1): println("It's an unit vector on the negative y-axis.") default: println("It's just an ordinary coordinate.") } switch coordinate { case (0,0): println("It's at origin!") case (_,0): println("(\(coordinate.0),0) is on the x-axis.") case (0,_): println("(0,\(coordinate.0)) is on the y-axis.") default: println("(\(coordinate.0),\(coordinate.1)) is just an ordinary coordinate.") }
海河之家
2014-10-29
0 回答
举报
0/150
提交
取消