downTo() 函数

如果你想以相反的顺序迭代数字?这很简单。你可以使用标准库中定义的 downTo() 函数

for (i in 4 downTo 1) print(i) // prints "4321"