In the future, C-style for operators will be removed from Swift . Although there are many alternative methods for using C-style statements for statements, such as stridestatements or statements ..<, they work only in certain conditions.
For example, in earlier versions of swift, you could scroll through all the other indices of String.CharacterView.Indexa String string using the C-style for operators
for var index = string.startIndex; index < string.endIndex; index = string.successor().successor(){
}
But it is now out of date. There is a way to do the same using a loopwhile
var index = string.startIndex
while index < string.endIndex{
index = index.successor().successor()
}
but this is nothing more than a workaround. There is a statement ..<that is perfect for scrolling through each row index
for index in string.startIndex..<string.endIndex
n-
"" , while? , , .successor() , stride ..< .