Marc Palmer
2007-03-06 09:45:08 UTC
Hi,
Is this an intentional break from Java?
def value = "hello"
def y = (value)
? value
: "no value"
This yields:
org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed, Script1: 4: unexpected token: ? @ line 4, column 3.
1 error
Now unless I've gone mad this is perfectly legal in Java. I am
guessing this is related to optional semicolons? Does this mean that
in Groovy all ternaries are supposed to be on one line?
def y = (value) ? value
: "no value";
results in:
org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed, Script5: 3: expecting ':', found '<newline>' @ line
3, column 24.
1 error
Thanks,
Marc
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
Is this an intentional break from Java?
def value = "hello"
def y = (value)
? value
: "no value"
This yields:
org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed, Script1: 4: unexpected token: ? @ line 4, column 3.
1 error
Now unless I've gone mad this is perfectly legal in Java. I am
guessing this is related to optional semicolons? Does this mean that
in Groovy all ternaries are supposed to be on one line?
def y = (value) ? value
: "no value";
results in:
org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed, Script5: 3: expecting ':', found '<newline>' @ line
3, column 24.
1 error
Thanks,
Marc
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email