I have several codes like the following:

for var i = 0; i < myarr.count; i += n { // the step is NOT 1
   // many codes
}

I knew I could use the while loop, but it seems very ugly.
var i = 0
while i < marr.count {
    // some codes

    i += n   // Sometimes it is easy to be missed
}


If no C-style for loop,  what's the best replacement for it ?
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to