闭区间
[a,b] ---> a...b
前闭后开区间
[a,b) ---> a..<b
for index in 1...10 println(index) // 输出1~10 for index in 0..<10 println(index) // 输出0~9 // index为常量,不需要指定类型
let names = ["jack","lily","allen "] for i in 0..<names.count { println(names[i]) }
时间: 2024-11-05 06:09:38