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

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)
主站蜘蛛池模板: 谢通门县| 巴林右旗| 佛坪县| 江都市| 长治市| 保康县| 抚松县| 柞水县| 汪清县| 兴宁市| 临沭县| 甘孜| 文安县| 方城县| 拉孜县| 永济市| 都昌县| 津市市| 哈尔滨市| 兴宁市| 万载县| 漳州市| 瑞昌市| 濮阳县| 娄底市| 新宁县| 建水县| 五指山市| 枝江市| 根河市| 丰台区| 普格县| 宣城市| 黎川县| 通河县| 延长县| 广德县| 新兴县| 泽州县| 潜山县| 安西县|