I literally use this meme in a slide when teaching while and do while.

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.

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.

glibg10b
link
fedilink
41Y

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

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.

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.

Years ago when this meme first came my way I tried to explain this and nobody agreed with me, it was driving me mad.

@wahming@monyet.cc
link
fedilink
English
21Y

Yeah I ran through the logic in my mind and got confused, came to the comments to ask what I was missing

katy ✨
link
fedilink
11Y

do run while not edge and not look down

HotsauceHurricane
link
fedilink
English
41Y

Sudo meme - -help

VicFic!
link
fedilink
5
edit-2
1Y

Why do you have the white bars on either side of the image?

Fixed.

👍Maximum Derek👍
link
fedilink
English
21Y

This is why computers should still have a Turbo button that limits the CPU to 8MHz.

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.

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.

katy ✨
link
fedilink
11Y

My dad’s computer had that and I loved pushing it :3

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 77 users / day
  • 211 users / week
  • 413 users / month
  • 2.92K users / 6 months
  • 1 subscriber
  • 1.53K Posts
  • 33.8K Comments
  • Modlog