//for 传统风格 for(index = 0;index <3;index++){ println index } //for-each风格 for(index in 0..3){ println index } //times风格 3.times { println it}
输出:
0 1 2 0 1 2 3 0 1 2
groovy for
最新推荐文章于 2022-12-01 13:10:09 发布
//for 传统风格 for(index = 0;index <3;index++){ println index } //for-each风格 for(index in 0..3){ println index } //times风格 3.times { println it}
输出:
0 1 2 0 1 2 3 0 1 2