Hacker News new | ask | show | jobs
by famousactress 5347 days ago
Yeah, is there precedent for that? It looks fucking nutty. Can you do it in the middle of the function!? So odd. There's a lot of cruft in java, but I'm not sure the return statement is even on the list of things I'd bother attacking.
3 comments

Functions in mathematics sets a good precedent for lack of a return keyword.

Where did you see that it says you can do it in the middle of a function? I understood it implicitly returns the last expression.

As far as a precedent, lisp does it that way, and it may be older than the existence of the return statement. Any language that lacks statements usually does it this way.
Lisp, Dylan, Smalltalk, ML, Haskell, CoffeeScript, and Dart all have various levels of implicit return. It makes sense in a language where there are no statements, just expressions.

Generally code is written to not need to return from the middle of a function. This is only really inconvenient in loops, and at least Dylan, Lisp, and Smalltalk make some provision for an "early return."

Someone said Dylan so I just respond...my favorite language of all times :)