Tsallaka zuwa abun ciki
Justice Tech School

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 false

Exercise

Run once at least.

 { } while c

Quiz Test

Which runs the body first?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.