News for hackers. Stuff that matters.
Re:Avoid Else, Return Early (2013) by randomerr on Monday March 26, 2018 @09:17AM (#16678608)
I guess I would politely argue that creating new functions would make reading code harder in basic example such are this. You'll be jumping all round or possibly separate files. Obviously larger logic tress should be pruned. Side note: a lambda function may get around this specific instance.
Re:Avoid Else, Return Early (2013) by Sean1708 on Monday March 26, 2018 @09:34AM (#16678703)
The simple cases do come up though. I've written plenty of functions which amount to little more than a single if-statement and I have had people ask me to make changes like

  foo(things) {
      stuff = do_work(things);

      if (stuff) {
          return a;
      } else {
          return b;
      }
  }
into

  foo(things) {
      stuff = do_work(things);

      if (stuff) {
          return a;
      }

      return b;
   }
in code reviews.