• QuazarOmega@lemy.lol
    link
    fedilink
    arrow-up
    0
    ·
    2 months ago

    No, no, you should group the return false lines together 😤😤

    if (number == 1) return false;
    else if (number == 3) return false;
    else if (number == 5) return false;
    //...
    else if (number == 2) return true;
    else if (number == 4) return true;
    //...
    
    • Destide@feddit.ukOP
      link
      fedilink
      English
      arrow-up
      0
      ·
      edit-2
      2 months ago

      As we’re posting examples I’ll add how lovely it is in Elixir. Elixir def not putting the fun in programmer memes do. One reason I picked it because I can’t be trusted to not be the meme.

      def is_even?(n) do
        rem(n, 2) == 0
      end
      
      • balsoft@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        2 months ago

        I mean, it would be almost this exact thing in almost any language.

        fn is_even(n: i64) -> bool {
            n % 2 == 0
        }
        
        even n = n `rem` 2 == 0
        
        def is_even(n):
            return n % 2 == 0
        

        etc

        • vinnymac@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          2 months ago

          Personal preference, but elixir just strikes a balance that doesn’t make me feel like I’m reading hieroglyphs so I’m actually happy to see it praised.

          • fushuan [he/him]@piefed.blahaj.zone
            link
            fedilink
            English
            arrow-up
            0
            ·
            2 months ago

            I would have preferred for the function to be called mod, since it’s the modulo operation, which in math is represented with a percentage or “mod”. Most programming languages use a percentage because of that, so do a lot of calculators.

          • balsoft@lemmy.ml
            link
            fedilink
            arrow-up
            0
            ·
            2 months ago

            Yeah, I agree that Elixir is a fine language for some tasks. I personally find the readability somewhat average, but it’s very maintainable (due to how it enables clear program structure), the error handling is great, and the lightweight process system is amazing.

  • 4am@lemmy.zip
    link
    fedilink
    arrow-up
    0
    ·
    2 months ago

    Fucking rent free. Jesus Christ you clowns, I almost want them to take away all your video games now

      • 4am@lemmy.zip
        link
        fedilink
        arrow-up
        0
        ·
        2 months ago

        I’ve never met anyone cool who cooks up strawmen memes because they’re exhausted all their actual criticisms.

        The piratesoftware shit is so tiresome. Who the fuck cares? What is this going to accomplish? He’s not even popular anymore

        • TrickDacy@lemmy.world
          link
          fedilink
          arrow-up
          0
          ·
          2 months ago

          Who cares? You. You’re the one who knows what this even is. ReNt FrEe is always a sign of having no argument

    • Ambii [she/her]@hexbear.net
      link
      fedilink
      English
      arrow-up
      0
      ·
      2 months ago

      oh no not my toys, like all good consoomers i put 99% of my self worth and identity into the things i consume mindlessly so this is devastating.

      • 4am@lemmy.zip
        link
        fedilink
        arrow-up
        0
        ·
        1 month ago

        I think you got wooshed here

        The guy in the picture is PirateSoftware, accused of sabotaging the Stop Killing Games initiative in the EU.

        This post is part of a coordinated harassment campaign by big angy gamers because bad nerd man say companies won’t listen to their little lib demands to the EU

        So instead of regrouping their efforts (which, I might add, they did, and they got their day in parliament) they (started off by) basically trashing this dude until he lost a large portion of his community. Because like they didn’t like how he defended his position. About video games. And now the fucking internet won’t shut up about it even though they got their way again through toxic bullying. And it annoys me. So I shitpost about it wherever I can because I hope it annoys them too.

        • There’s a lot of distorted facts here, but the weirdest one to me is “instead of regrouping their efforts (which, I might add, they did, and they got their day in parliament)”. The first half just contradicts itself (“instead of doing X, which they did, …”???) and the second half (“they got their day in parliament”) is verifiably, obviously false: The EU petition is still ongoing and collecting signatures. The deadline is July 31.

  • 6stringringer@lemmy.zip
    link
    fedilink
    arrow-up
    0
    ·
    2 months ago

    Thanks to goodness, finally. A (giggle & snort) solid algorithm. There ya’s go set yer clocks & go get a haircut.

  • FunkyStuff [he/him]@hexbear.net
    link
    fedilink
    English
    arrow-up
    0
    ·
    edit-2
    2 months ago

    Throwback to when someone shared the OG version of this meme to my uni chat, I replied with "Oh you can simply do

    def is_even(n: int) -> boolean:
        if n > 0 return not is_even(n - 1)
        elif n < 0 return not is_even(n + 1)
        else return True
    

    And instead of laughing at the joke the TA in the chat said “When you start getting internships you’ll do n % 2” like I was being serious.