Ranged indeces in for loops

Jul 18, 2014 00:00 · 42 words · 1 minute read swift

Traditionally one would have to say

for var i = 0; i < 4; ++i {
    forLoopA += i
}

Now in Swift one can use the Half-Open Range Operator index to say

for i in 0..<4 {
    forLoopB += i
}