monero.town
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
OttoVonNoob@lemmy.ca to Programmer Humor@programming.dev · 1 年前

You seen the jank? I live in it.. molded by it...

lemmy.ca

external-link
message-square
9
link
fedilink
177
external-link

You seen the jank? I live in it.. molded by it...

lemmy.ca

OttoVonNoob@lemmy.ca to Programmer Humor@programming.dev · 1 年前
message-square
9
link
fedilink
alert-triangle
You must log in or # to comment.
  • grandma@sh.itjust.works
    link
    fedilink
    arrow-up
    8
    ·
    1 年前

    Early returns save lives

  • notprogrammer@programming.dev
    link
    fedilink
    arrow-up
    5
    ·
    1 年前

    But what if I were to add more ‘and’

    It would be extremely painful

    • magic_lobster_party@fedia.io
      link
      fedilink
      arrow-up
      3
      ·
      1 年前

      You’re a big function

      • usernamefactory@lemmy.ca
        link
        fedilink
        English
        arrow-up
        3
        ·
        1 年前

        For you

  • Odinkirk@lemmygrad.ml
    link
    fedilink
    arrow-up
    5
    ·
    1 年前

    That’s why you set the alternate/exit cases as individual if statements before whatever was going to be inside the original if block.

    To me too long to learn that.

    • Traister101@lemmy.today
      link
      fedilink
      arrow-up
      6
      ·
      1 年前

      My code got much more readable when I learned about early returns lol

      • lad@programming.dev
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 年前

        Early returns improve readability in that they make it simpler to read, but I also find them decreasing readability in that you may miss an early return and wonder why is execution not hitting the line you expect it to

        • Traister101@lemmy.today
          link
          fedilink
          arrow-up
          3
          ·
          1 年前

          I’d say in most cases that’s a sign something needs to be extracted into a separate function. Course sometimes code is just complicated and extracting only makes things harder to follow. Even then I’d much rather use early return than nested ifs as those are significantly harder for me to follow.

  • dance_ninja@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    1 年前

    Gotta go fast

Programmer Humor@programming.dev

programmer_humor@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: [email protected]

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics
Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 1.22K users / day
  • 4.57K users / week
  • 8.06K users / month
  • 17.5K users / 6 months
  • 22 local subscribers
  • 31.3K subscribers
  • 2.31K Posts
  • 86.9K Comments
  • Modlog
  • mods:
  • Feyter@programming.dev
  • adr1an@programming.dev
  • BurningTurtle@programming.dev
  • Pierre-Yves Lapersonne@programming.dev
  • BE: 0.19.13
  • Modlog
  • Legal
  • Instances
  • Docs
  • Code
  • join-lemmy.org