while and repeat
while checks first and repeat while runs at least once.
Example
var n = 3
while n > 0 { print(n, terminator: " "); n -= 1 }
print()
repeat { print("once") } while falseExercise
Run once at least.
{ } while cQuiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.