Tsallaka zuwa abun ciki
Justice Tech School

while and do while

while checks first and do while runs at least once.

Example
var n = 3
while (n > 0) { print("$n "); n-- }
println()
do { println("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.