海河之家
2014-10-29 22:30
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.")
}还没有人回答问题,可以看看其他问题
玩儿转Swift
57354 学习 · 514 问题
相似问题