groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul King <pa...@asert.com.au>
Subject Re: multi-declaration does not work in the for loop, groovy 2.4
Date Mon, 06 Aug 2018 14:10:31 GMT
Yes, that is by design for 2.4.x, you'll have to bring one of the
declarations outside the loop or use one of the many internal iteration
approaches. The Parrot parser handles that syntax.

On Mon, Aug 6, 2018 at 11:37 PM ocs@ocs <ocs@ocs.cz> wrote:

> Hi there,
>
> I have just bumped into a — presumably — parser error, which causes that a
> declaration of more variables is not accepted in a for loop:
>
> ===
> 44 */tmp>* /usr/local/groovy-2.4.15/bin/groovy q
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
> failed:
> /private/tmp/q.groovy: 1: unexpected token: = @ line 1, column 13.
>    for (int foo=0,bar=0;foo<bar;foo++)
>                ^
> 1 error
> 44 */tmp>* /usr/local/groovy-2.4.15/bin/groovy -version
> Groovy Version: 2.4.15 JVM: 10.0.1 Vendor: "Oracle Corporation" OS: Mac OS
> X
> 45 */tmp>*
> ===
>
> At the moment alas I can't test in newer groovys, not sure whether the
> problem is fixed there or not.
>
> All the best,
> OC
>
>

Mime
View raw message