logo
  • 教程列表
  • SO官方文档
  • 范围
    • 积分类型范围
    • downTo() 函数
    • step() 函数
    • 直到功能
  1. StackOverflow 文档
  2. Kotlin 教程
  3. 范围
  4. step() 函数

step() 函数

Created: November-22, 2018

是否可以使用任意步骤迭代数字,不等于 1?当然,step() 函数会对你有所帮助

for (i in 1..4 step 2) print(i) // prints "13"
for (i in 4 downTo 1 step 2) print(i) // prints "42"
  • 直到功能
  • downTo() 函数

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明