1.區(qū)間運算符
?閉區(qū)間[a,b]-------> a...b
?前閉后開區(qū)間[a,b)------->a..<b
2.for-in循環(huán)
for 變量名 in 區(qū)間
{ ... }
例子:
for index in 1...10{ println("\(index)") //index 是一個常量羽杰,不需要顯示聲明 }
遍歷一個數(shù)組
var arrays = ["a","b","c","d","e"] for i in 0..<arrays.count { println(arrays[i]) }
3.邏輯運算符
?與---------> a && b
?或---------> a || b
?非---------> !a