• mryessir
    link
    fedilink
    arrow-up
    4
    ·
    2 years ago

    Please elaborate. When and why would his suggestion be worse?

    • mellejwz@lemmy.world
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      2
      ·
      2 years ago

      It will check all of the if statements instead of stopping at the first match.

        • mellejwz@lemmy.world
          link
          fedilink
          English
          arrow-up
          2
          ·
          2 years ago

          My bad, I looked over the returns. If you return something there wouldn’t be much difference between both.

          • Cosmicomical@lemmy.world
            link
            fedilink
            arrow-up
            1
            ·
            2 years ago

            Ok just to clarify this was a joke. It was just a pedantic improvement on a deranged solution. The only sensible way to do this is with % 2 or with bitwise operations imo.