Details
-
Type:
Improvement
-
Status:
Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:all
Description
Currently it seems that the "return" keyword is only optional for the last statement before the closing brace of a method. It would be nice if it were optional everywhere so that the value of the last expression evaluated is returned. For example,
myMethod() {
try {
return calculateSomething()
} catch (SomeException e) {
return calculateSomethingElse()
}
}
Currently those return keywords are required.
Issue Links
- is depended upon by
-
GROOVY-762
implement syntax improvements
-
Only possible as the last statement.