swift笔记1-点语法
var firstForLoop = 0 for i in 0...3 { firstForLoop += i i } firstForLoop
1 两个点代表是左闭右开 即0,1,2
2 三个点代表全集合 即0,1,2,3
func sumOf(numbers: Int...) -> Int { var sum = 0 for number in numbers { sum += number } return sum }
...表示任意个数的参数
var firstForLoop = 0 for i in 0...3 { firstForLoop += i i } firstForLoop
1 两个点代表是左闭右开 即0,1,2
2 三个点代表全集合 即0,1,2,3
func sumOf(numbers: Int...) -> Int { var sum = 0 for number in numbers { sum += number } return sum }
...表示任意个数的参数