1
2
3
4
5
6 |
var firstForLoop = 0 for i in
0...3 { firstForLoop += i i } firstForLoop |
1 两个点代表是左闭右开 即0,1,2
2 三个点代表全集合 即0,1,2,3
1
2
3
4
5
6
7 |
func sumOf(numbers: Int...) -> Int { var
sum = 0 for
number in
numbers { sum += number } return
sum } |
...表示任意个数的参数
原文地址:http://www.cnblogs.com/qiqingnan/p/3766721.html