• snowraven@sh.itjust.works
    link
    fedilink
    arrow-up
    151
    arrow-down
    1
    ·
    edit-2
    1 year ago

    Purely in technical terms, this meme doesn’t really fit unless they start running literally from the edge.

    While and do while are equal except for the very first test. So if the very first test does not evaluate to false, they are essentially same. In the meme that implies they started running sometime before reaching the edge, that runs the “run()” atleast once and later on for every run it would be checked and it would be false at the cliff edge.

  • hperrin@lemmy.world
    link
    fedilink
    arrow-up
    38
    ·
    1 year ago

    When productivity is measured in lines of code:

    do {
      if (!edge) {
        run();
      }
    } while (!edge);
    
    • Square Singer@feddit.de
      link
      fedilink
      arrow-up
      7
      ·
      1 year ago

      It’s still ironic to me that the turbo button’s purpose was to limit the CPU speed.

      You know, like you use a turbo on a car to limit it’s performance.

      • xmunk@sh.itjust.works
        link
        fedilink
        arrow-up
        5
        ·
        1 year ago

        Naming things is one of the two hard problems in computer science and the turbo button was the button you press if your computer is going too fast… it made sense from someone’s point of view.

        • 👍Maximum Derek👍@discuss.tchncs.de
          link
          fedilink
          English
          arrow-up
          7
          ·
          edit-2
          1 year ago

          Brands starting doing this in the 486 days to match customer expectation. In the 286 and 386 days it slowed the PC down to 8MHz. It was called turbo because it was 8088 Turbo mode, as the 8088 nominally operated at 4.7MHz.

          Source: Those of around since the 8088 days viciously mocked the brands that did this on newsgroups because they were catering to newbs… or whatever we called them back then.

        • Square Singer@feddit.de
          link
          fedilink
          arrow-up
          3
          ·
          edit-2
          1 year ago

          After they flipped the meaning. But even then, if the PC didn’t have the button it would run at full speed.

          Turning it off would limit the speed. So the purpose of the existence of the button was not to make the PC go faster, but rather to make it go slower if you turned it off.

          It’s kinda like as if the eco mode button in you car was labelled “turbo mode” with flipped meaning.

    • glibg10b@lemmy.ml
      link
      fedilink
      arrow-up
      27
      arrow-down
      3
      ·
      1 year ago

      Well, it’s wrong. The only difference between the two kinds of loops is that do-while starts by unconditionally running the body once

      • KTVX94@lemmy.myserv.one
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        Yes, that’s true. It’s also good enough to make an abstract concept more approachable while getting a kick out of it too. Honestly this is more of a “well akcshually” thing that someone who already knows how this works would point out (nobody has so far) than something that misleads students who don’t get it. It works.

    • xmunk@sh.itjust.works
      link
      fedilink
      arrow-up
      11
      ·
      1 year ago

      Please switch over to something that actually has a condition that needs to logically be evaluated on each step and not as an end condition - yes this meme is technically correct for the case where they both start adjacent to the cliff and programmers should always consider (cliff) edge cases… but the visual strongly implies they’ve been running for a while.

      • KTVX94@lemmy.myserv.one
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        I mean yeah, it does have that problem, but even if it’s not entirely accurate it’s good enough to illustrate an otherwise abstract concept that’s not exactly easy to understand for someone who’s just getting started with programming and may not really be interested in it, rather looking to be an artist or game designer. Also humor really helps when it comes to learning. It does way more good than bad in my experience so far.