In programming, you frequently need to do the same thing over and over again. For example, each month, the company you work for will need to generate payroll slips for each employee. If you have 10,000 employees, it would be inefficient to write 10,000 instructions. Repeating a single instruction 10,000 times would be better, and loops are used for this.
There are three types of loop; the for-in loop, the while loop, and the repeat-while loop. Let's look at each type in turn, starting with the for-in loop, which is used when you know how many times a loop should be repeated.
For more information on loops, visit: https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html.