I'm trying to skip in a random condition that if true, will skip a loop, but results are printing all elements 0,1,2,3,4
I know in Java if index is incremented index will skip, but this is not happening Swift.?
Update: this is a simplified version of some program I wrote, the print() has to be happen right after each loop, and index is ONLY incremented 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
}
}