this post was submitted on 30 Sep 2023
943 points (96.4% liked)

Programmer Humor

32048 readers
1535 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 152 points 11 months ago* (last edited 11 months ago) (3 children)

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.

[–] [email protected] 64 points 11 months ago (1 children)

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

[–] [email protected] 36 points 11 months ago (2 children)
do { explain } while ( !they.understand )
[–] [email protected] 54 points 11 months ago (1 children)
do {
    say("I use Arch btw");
} while ( they.interested );

This loop never runs twice.

[–] [email protected] 12 points 11 months ago

Finally a correct application for the do-while meme!

[–] [email protected] 7 points 11 months ago

Ruby has a fun until for refuted conditionals!

until(they.understand) { explain }

Reads like English 🙃

[–] [email protected] 8 points 11 months ago

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

[–] [email protected] 4 points 11 months ago (1 children)

Yep, replace edge with isOnGround or something

[–] [email protected] 8 points 11 months ago (1 children)

Actually, doesn't change the matter.

[–] [email protected] 4 points 11 months ago

Yep, needs to check if the next step has ground, otherwise you're already falling.