首页 > 学院 > 开发设计 > 正文

Groovy整型循环

2019-11-08 03:19:08
字体:
来源:转载
供稿:网友

Groovy整型循环

java中使用for关键字实现循环,在Groovy中有更多的实现方式。1、范围
for (i in 1..3) {    PRintln i}返回1232、upto和downto
1.upto(3) {	println it}3.downto(1) {	println it}返回1233213、times方法
3.times {	println it}返回0124、step方法
1.step(7, 2) {	println it}返回135
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表