使用范围

for (i in 1..100) { ... } // 全闭区间,包括100
for (i in 1 until 100) { ... } // 左闭右开区间,不包括100
for (x in 2..10 step 2) { ... }
for (x in 10 downTo 1) { ... }
if (x in 1..10) { ... }

results matching ""

    No results matching ""