Swift中的switch语句的类另用法:
// 强大的switch语句
var a:Int = 100
switch a {
case a where a < 0:
println("Negative")
case a where a == 0:
println("Zero")
case a where a > 0:
println("Positive")
default:
println("Unknow")
}
Swift中的switch语句的类另用法:
// 强大的switch语句
var a:Int = 100
switch a {
case a where a < 0:
println("Negative")
case a where a == 0:
println("Zero")
case a where a > 0:
println("Positive")
default:
println("Unknow")
}