jastrachan | 26 Jan 15:18 2005
Picon

Re: [groovy-dev] Diff of Java and Groovy grammars

On 26 Jan 2005, at 13:42, Guillaume Laforge wrote:
>> Personally I am totally happy with last expression give the return 
>> value
>> but I can live with returns required.
>
> But there are cases where your last statement is a call to a function
> with side effects that returns a value, but you don't want your
> closure or function to return that value! So you'd have to put a dummy
> last statement? or null?

imagine method

String foo() {
     toString()
}

would be equivalent to

String foo() {
     return toString()
}

But if you really didn't wanna return the value of the last expression, 
use an explicit return

String foo() {
     toString()
     return null
}

James
-------
http://radio.weblogs.com/0112098/


Gmane