• Omega_Haxors@lemmy.ml
          link
          fedilink
          arrow-up
          1
          arrow-down
          5
          ·
          edit-2
          10 months ago

          You’re writing extremely bad code if that’s the case and you need to refactor. The point of a function is to return a value. Anything else is just there to waste cycles and make the code less readable. You should also never use else statements for arithmetic due to their massive relative overhead. Your processor can do multiple arithmetic operations in the time it takes to process one if statement, and don’t get me started on people who demand you use nested if even though switch statements are way faster and leagues more readable.

          • SpeakinTelnet@programming.dev
            link
            fedilink
            arrow-up
            5
            ·
            edit-2
            10 months ago

            I disagree but you do you.

            Edit: dammit you edit your comment a lot for someone who claims to know how to write code properly.

            • Omega_Haxors@lemmy.ml
              link
              fedilink
              arrow-up
              1
              arrow-down
              5
              ·
              edit-2
              10 months ago

              Those who are the most wrong have the strongest conviction

              EDIT: I make a lot of edits because unlike you, I care about the quality and accuracy of what I write. You’re going to spend like an extra 10 minutes tops writing for something that will be read by thousands for years to come. It’s basic courtesy.

                • Omega_Haxors@lemmy.ml
                  link
                  fedilink
                  arrow-up
                  1
                  arrow-down
                  1
                  ·
                  edit-2
                  10 months ago

                  Yeah i’m starting to remember why I quit. In any other industry toxic shit like this goes sinks to the bottom, not the top.

                  Like seriously, what were you hoping to accomplish with this one? The thread ended yesterday. That’s reddit tier douchery.

          • 1rre@discuss.tchncs.de
            link
            fedilink
            arrow-up
            4
            ·
            10 months ago

            Who’s suggesting that people are using if statements for arithmetic?

            The only time that you can feasibly replace an if statement with arithmetic is if it’s a boolean, but frankly that’s an edge case… Also if you’re not writing in rust or c or whatever then don’t worry as the interpreter will run a huge amount of branches for every line of code (which is what all your nested ifs, switches, gotos, returns etc. will compile down to anyway)