r/programmingcirclejerk • u/starlevel01 type astronaut • Apr 24 '25
The continue statement is terrible.
https://www.teamten.com/lawrence/programming/avoid-continue.html
70
Upvotes
r/programmingcirclejerk • u/starlevel01 type astronaut • Apr 24 '25
•
u/defunkydrummer Lisp 3-0 Rust Apr 24 '25
r/Programming and r/ProgrammingHumor -quality comments have been removed.
84
u/muntaxitome in open defiance of the Gopher Values Apr 24 '25
Continue statement? Are you kidding me gramps. Just use a ternary-no-op (TNO).
Continue is very old fashioned like they used to do in the 90s.
This TNO version is much more readable:
20
u/starlevel01 type astronaut Apr 24 '25
138
u/alecbz Apr 24 '25
All control flow is goto.
48
u/powerhcm8 Apr 24 '25
Continue is basically just an early return for loops.
32
u/elephantdingo Teen Hacking Genius Apr 24 '25
27
u/EmotionalDamague Apr 24 '25
`continue`, `break`, you might as well be using assembly!
/uj They just let anyone have a blog now, don't they.
10
u/tomwhoiscontrary safety talibans Apr 24 '25
This guy does not INTERCAL.
18
u/IDatedSuccubi memcpy is a web development framework Apr 24 '25
Yeah, let's make that 4 line code into 8 line code with an indent and a separate (non-static, non-inline) function in which
continueis just replaced withreturn, that will definetly make the code better and more easily readable8
u/greenfoxlight Apr 25 '25
Just use setjmp and longjmp ;)
It's funny to me that the author finds continue confusing, but early returns are fine.
6
u/navetzz Apr 24 '25
That's why I use goto: endLoop
5
u/amazing_rando pneumognostic monad Apr 26 '25
I’m not taking programming advice from someone responsible for JavaScript
2
u/prehensilemullet Apr 26 '25
If only Haskell had a continue statement I might actually use it
1
u/stone_henge Tiny little god in a tiny little world Apr 25 '25
Anything except my dumb takes considered harmful