区间运算符(…),一般用于 for 循环
//1~10 包括10
1...10
for index in 1...10{
print( index)
}
//半开区间运算符
//1~10 不包括10
for index in 1..<10{
print(index)
}
var names = ["name1","name2","name3","name4","name5"]
names[1...3]
for index in 0 ..< names.count{
print("name:\(names[index])")
}
names[0...1] = ["zhangsan","lisi"]
print(names)