June 2018
Intermediate to advanced
310 pages
6h 32m
English
There are no changes to the while loop functionality, so we'll cover them very briefly:
var x = 0while (x < 10) { x++ println(x)}
This will print numbers from 1 to 10. Note that we are forced to define x as var. In the following chapters, we'll discuss much more idiomatic ways to do this.
The lesser used do while loop is also present in the language:
var x = 5 do { println(x) x--} while (x > 0)
Read now
Unlock full access