Swift Looping and Enumeration

Explore Swift's looping constructs and learn how to iterate over collections, ranges, and more.

Swift Looping and Enumeration
Photo by Crystal Collis / Unsplash

Explore Swift's looping constructs and learn how to iterate over collections, ranges, and more.

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

let fruits = ["Apple", "Banana", "Orange"]
for fruit in fruits {
    print(fruit)
}