官术网_书友最值得收藏!

While loop

There are no changes to the while loop functionality, so we'll cover them very briefly:

var x = 0
while (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)
主站蜘蛛池模板: 汨罗市| 侯马市| 河西区| 鲁山县| 金坛市| 潞城市| 临夏市| 南澳县| 垣曲县| 循化| 龙胜| 陆川县| 抚远县| 益阳市| 吉林省| 马边| 石城县| 怀安县| 罗甸县| 松溪县| 赤水市| 武川县| 陆丰市| 巫溪县| 锦屏县| 博湖县| 文昌市| 大新县| 陆川县| 汪清县| 蕉岭县| 鄂州市| 武宣县| 潞西市| 浮山县| 法库县| 襄樊市| 泰宁县| 临夏市| 文昌市| 永泰县|