Since C-style for statement is deprecated and will be removed in a future version of Swift, what is the best way to achieve the following:
for var i = startIndex; i != endIndex; i = (i + 1) % arrCount {
}
(I want to iterate the array, but start from somewhere at the middle and continue until I'll reach the index I started from)
Edit: startIndex > endIndex
"while" should be the best:
var i = startIndex
while i != endIndex {
i = (i + 1) % arrCount
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With