//swift的广义匹配 let x = 1000 switch x { case 1...9: println("个位数") case 1...9: println("十位数") default: println("其他") } let point = (10,10) switch point { case (0,0): println("0坐标") case (1...10,1...10): println("x y一到十") case (_,0): println("x轴") default: println("其他") } // Value Bindings switch point { case (let x, 10): println(x) case let( x, y) where x == -y: println("(x):(y)") default: println("其他") }