for(i=2;i<=num/2;i++){
}
How to write this loop in swift3 without using while loop and repeat while loop?
I want to use only for loop for this.But right now Swift3 remove the old c styling loop.
for(i=2;i<=num/2;i++){
}
How to write this loop in swift3 without using while loop and repeat while loop?
I want to use only for loop for this.But right now Swift3 remove the old c styling loop.
You should write this:
for i in stride(from: 2, through: num/2, by: 1)
{
print(i)
}