Ranges
Count with Swift's neat range syntax.
1for number in 1...5 {
2 print(number)
3}
$ swift main.swift
1
2
3
4
5
Every line, explained
for number in 1...5 {- 1...5 is a closed range: every whole number from 1 to 5, INCLUDING both ends. (Swift also has 1..<5, which stops just before 5.) No counter setup, no i++; ranges make counting loops beautifully tidy.
print(number)- print(...) shows whatever is inside its round brackets in the terminal, then moves to a new line. All lowercase, both brackets needed, and no semicolon at the end; Swift doesn't use them. Runs five times, printing 1, 2, 3, 4, 5.
}- This } closes the for loop.