用了while, do...while, for in, for in ...
{ temp += i i++ } println(temp) do { temp2 += j j++ } ) println(temp2) ... { temp3 += a } println(temp3) for b in 1..1000 { temp5 += b} PS:..表示不包括上限,...表示包括上限 println(temp5) ; b < ; b++ { temp4 += b; } println(temp4)
func makeIncrementer() -> (Int -> Int) {
func addOne(number: Int) -> Int {
return 1 + number
}
return addOne
}
var increment = makeIncrementer()
println(increment(7))