13

One time i forgot that there are languages where you have to explicitly return stuff and spent a good 20 minutes debugging why
function a() { 2 }
didnt work

Comments
  • 5
    I’ve never been able to decide if I like implicit returns or not.

    On one hand, they make simple methods shorter and cleaner. On the other, they can make non-trivial functions much harder to read — and the linters complain when you use explicit returns where they add clarity.

    I suppose I just don’t like the standard linter rules, or messy code.
  • 3
    I like JavaScripts way of doing it, where you have explicit returns in everything but one line arrow functions. That way you get the clarity of explicit return while you also have the code beauty of implicit returns
  • 2
    Arrow functions can have single expression bodies, which fixes simple functions. If the body is complex enough to warrant a block, an explicit return is better for readability.
  • 0
    Guys i absolutely dont care whether yall like implicit returns or not
  • 7
    @yellow-dog We don’t care whether or not you care if we like implicit returns or not. 😊
  • 0
    @Root i will grind your bones to a fine paste 💚
  • 0
    What retarded language would allow that ??
  • 0
    @10Dev same with lambda in c# which I mistook arrow functions for lol
  • 0
  • 2
    Implicit return is good only when everything is immutable.
  • 2
    @Oktokolo as all things should be
Add Comment