开发者

how to do this in groovy, range from 1 and greater

开发者 https://www.devze.com 2023-03-22 06:32 出处:网络
I want numbers from 1 and greater I tried 1..n, but thi开发者_JS百科s doesn\'t work So I can\'t do this in Range?

I want numbers from 1 and greater I tried 1..n, but thi开发者_JS百科s doesn't work So I can't do this in Range?

thanks


1..Integer.MAX_VALUE
or 
1..Long.MAX_VALUE

What do you want n to signify ?


This works for me:

def n = 3
def range = 1..n
range.each { println it }

Output:

$ groovy range.groovy 
1
2
3

Can you provide a script that isn't behaving as you would like?

0

精彩评论

暂无评论...
验证码 换一张
取 消