Hi all,

     We always have to check the returning value, if it match some condition, 
return it. How about simplifying it? Let's see an example:

```
def m() {
    def r = callSomeMethod()
    if (null != r) return r

    return theDefaultResult
}
```

How about simplifying the above code as follows:
```
def m() {
    return? callSomeMethod()
    return theDefaultResult
}
```

Futhermore, we could make the conditional return more general:
```
def m() {
    return(r -> r != null) callSomeMethod() // we could do more checking, e.g. 
r > 10
    return theDefaultResult
}
```

    Any thoughts?

Cheers,
Daniel Sun

Reply via email to