DAY #12

There are 5+ ways to write a loop in Swift

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
for i in 13 { } //range

for i in collection { } //over a collection

for i in stride() { } //striding

while () { } //while

repeat { } while () //Same thing, but condition is after body.

//Higher order solutions
.forEach {}
.map {}

Originally published 04/14/2021 @ https://pittcsc.org/ Discord

Published here on 09/08/2022. Blog published date reflects the original date of publication.