Check out example codes for "how to loop swift". It will help you in understanding the concepts better.

Code Example 1

for n in 1...5 {
    print(n)
}

Code Example 2

for n in 1...5 {
    print(n)
}

// Output: 1 2 3 4 5

Learn ReactJs, React Native from akashmittal.com