0
var index = 30
switch index {
case 10 :
println("Value of index is 10")
case 20 :
case 30 :
println("Value of index is either 20 or 30")
case 40 :
println("Value of index is 40")
default :
println("default case")
}
此處使用貫穿的好例子http:// st ackoverflow.com/a/31782490/2303865 –