Menu
The first computer mouse had only one button.
Home
Hot
Random
Search
Browse
AI
AWS
Agile
Algorithms
Android
Apple
Azure
Backend
Bash
C++
Cloud
All Categories
HTTP 418: I'm a teapot
The server identifies as a teapot now and is on a tea break, brb
HTTP 418: I'm a teapot
The server identifies as a teapot now and is on a tea break, brb
Do-while Memes
Posts tagged with Do-while
Loop Logic: The Cliff Of Execution
Programming
Algorithms
Debugging
12 months ago
581.3K views
1 shares
The eternal battle between while-do and do-while loops played out through Road Runner and Wile E. Coyote! On the left, Road Runner safely checks the condition (!edge) before running, saving himself from the cliff. Meanwhile, poor Coyote executes run() first and only checks (!edge) after he's already airborne. And that's why you always validate before executing, folks! The difference between falling and living another day is literally one line of code.
The Edge Case Cliff Disaster
Programming
Debugging
Algorithms
Javascript
1 year ago
576.5K views
1 shares
The classic Road Runner vs. Wile E. Coyote scenario reimagined as a programming loop disaster! On the left, Road Runner's code uses a proper while (not edge) { run(); } loop that will terminate when reaching the cliff edge. Meanwhile, poor Coyote is using a do { run(); } while (not edge); loop—checking the condition after execution. He's already run off the cliff because his condition check comes too late! The fundamental difference between pre-test and post-test loops perfectly illustrated through cartoon physics. The variable edge isn't even defined until it's too late, and by then gravity.js has already been imported!
Logical Loops: Look Before You Leap
Programming
Debugging
Algorithms
1 year ago
469.7K views
0 shares
The classic Road Runner vs. Wile E. Coyote saga gets a programming twist! The Road Runner (left) uses a while loop that checks the condition before running, so he stops safely at the cliff edge. Meanwhile, our poor Coyote friend uses a do-while loop that checks the condition after execution—meaning he'll always run at least once... right off that cliff. This is basically the difference between looking before you leap and leaping before you look. After 15 years of coding, I still occasionally make this mistake and then stare at my monitor with the same expression as that coyote.
Do While Loop
Programming
Algorithms
Debugging
1 year ago
350.2K views
1 shares
This is basically how a do-while loop works in real life. First message: "I will be there in 5 minutes" (the initial statement that runs once). Second message: "If you don't?" (the condition check). Third message: "Re-read the message" (repeat the loop body). The beauty here is that unlike a while loop that checks conditions first, a do-while executes at least once before checking if it should continue—just like that promise to arrive in 5 minutes that inevitably turns into an infinite loop of excuses. The eternal programmer's time estimation paradox, but in relationship form!
Today's picks
Bose QuietComfort Ultra Bluetooth Headphones (2nd Gen), Wireless Headphones with Spatial Audio, Over Ear Noise Cancelling with Mic, Up to 30 Hours of Play time, Desert Gold - Limited Edition Color
Affiliate
$399.99
When Your RTX 4090 Can't Handle A Game From Your Childhood
Hardware
9.4M views
1 month ago
Interesting
Backend
28.6K views
4 years ago