How we can differentiate for loop and for each loop in swift language ?
Asked
Active
Viewed 330 times
2 Answers
2
If you want to do it with some step, just use it (step is 2):
for i in stride(from: 0, to: 100, by: 2) {
print(i)
}

Vlad Khambir
- 4,313
- 1
- 17
- 25