Coding conventions says `Prefer using the expressi...
# codingconventions
m
Coding conventions says
Prefer using the expression form of try, if and when.
Should I apply this with no exceptions? e.g.
Copy code
fun doSomething(x: Int): Int {
    if (x > 10) {
        <http://log.info|log.info>("an info")
        someAction()
        return 5
    } else {
        log.error("an error")
        return 10
    }
}
Should this be converted to return the
if
expression?
g
It says
Prefer
not
Must
m
would you prefer the conversion in this case?
g
In this particular case probably yes, if I would add a few more lines probably would use 2 return
👍 1