Sylvain Wallez wrote:

> 
> Really?
> 
>     Object result;
>     if (condition) {
>         result = foo;
>     } else {
>         result = bar;
>     }
>     return result;
> 
> or also
>     Object result = bar;
>     if (condition) {
>         result = foo;
>     }
>     return result;
> 
> Doesn't look better to me.
> 
No no, wait a second - the first one is the way a would write it and it
doesn't have an unnecessary else statement as it doesn't have a return
statement.

> Ok, I'll write "return cond ? foo : bar" from now on which is a single 
> return statement...
> 
Whatever. As others already stated, whoever writes the code decides how
it's written (apart from the few coding standards we agreed on and use).

Carsten
-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Reply via email to