tags:

views:

48

answers:

2

Hi,

The following Groovy code:

1.upTo(5) {println it}

Produces this compilation error:

No signature of method: java.lang.Integer.upTo() is applicable for argument types: (java.lang.Integer, ConsoleScript4$_run_closure1) values: [5, ConsoleScript4$_run_closure1@e83c97]

It appears that the method call matches the signature of this method, so what's the problem?

Thanks, Don

+3  A: 
1.upTo(5) {println it}

should be

1.upto(5) {println it}

(Its an error in case... the "t" should be lower-case in "upto")

jsight
Wow, that's embarassing
Don
+1  A: 

The problem is the case on the upto call:

groovy -e " 1.upto(5) { println it } "
Michael Easter