I try to skip in the random condition that if true, skip the loop, but the results will print all the elements 0,1,2,3,4 I know that in Java, if the index increases, the index will skip, but this does not happen. Swift.?
Update: this is a simplified version of some program that I wrote, print() should happen immediately after each cycle, and the index ONLY increases in some unknown conditions, I want it to behave like JAVA.
for var index in 0..<5 { print(index)//this prints 0,1,2,3,4, this must happen right after for loop if some unknown condition { index+=1 } }
source share