|
|
|
|
|
by eweise
1346 days ago
|
|
"For example, lots of Java devs are against early and multiple returns to the point of absurdity, while in functional languages this is idiomatic and no problem at all." Which functional language are you talking about? Of the two functional languages I know, Elm can only have a single return statement. Scala encourages a single return. |
|
To make an example the following expression can be considered to have two returns:
The Java equivalent is Some people abhor the idea of having multiple returns in a method, and say that you should write it like (Disclaimer: Contrived and buggy example as I am on mobile)