while loops in swift code example
Example 1: how to loop swift
for n in 1...5 {
print(n)
}
// Output: 1 2 3 4 5
Example 2: while loop swift
// runs until some boolean expression is false
while booleanExpression {
//block of code to be executed...
}