frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Avoid Continue

https://www.teamten.com/lawrence/programming/avoid-continue.html
2•todsacerdoti•1y ago

Comments

zoezoezoezoe•1y ago
I dont know if I fully agree. Sure, there is definitely an argument the be had about whether or not `continue` is the best word to use in this instance, but why avoid it entirely? Every programmer is able to easily understand what code like this would do:

``` for (Node node : nodeList) { if (node.isBad()) { continue; } processNode(node); } ```

Every keyword in any programming language is largely arbitrary in my opinion let's take a look at the beginning of the codeblock `for (Node node : nodeList)` also completely arbitrary, though it's clear to anyone who's ever written C++ that it is equivalent to saying "for every node in nodeList".

Continue is not meant to read as "continue execution" it's meant to be "continue to the next item of the list", and I think avoiding it entirely is a pointless effort.

Ukv•1y ago
I feel `skip` may have been a better name, but disagree with it being logically difficult to parse beyond that.

If I'm reading a loop and see

    for x in y {
        if exclusions.contains(x) { skip; }
        if x.children.length == 0 { skip; }
        if os.file.exists(x.name) { skip; }
        ...
I instantly know that processing for those elements is skipped, and they won't be relevant for the rest of the loop.

Whereas if I see

    for x in y {
        if !exclusions.contains(x) {
            if x.children.length != 0 {
                if !os.file.exists(x.name) {
        ...
I feel like there's still mental overload with not knowing where those `if` blocks end, and so having to keep the conditions in mind. It doesn't immediately tell me that the rest of the loop is being skipped.

The `log()` mistake seems no less likely to happen using early-returns in function instead, and I'd argue nesting checks actually introduces more room for that kind of error overall, where you append something at the end within the wrong set of brackets, compared to a flatter structure.

Ask HN: What are you reading? (November 2026)

1•marai2•49s ago•0 comments

A short explainer on how El Niño works [video]

https://www.youtube.com/watch?v=7_JF3etiAv8
2•nharada•3m ago•0 comments

Can someone explain this insanely creepy response?: R/ChatGPT

https://www.reddit.com/r/ChatGPT/comments/1xwn2bu/can_someone_explain_this_insanely_creepy_response/
2•olalonde•6m ago•0 comments

Zelensky urges US and Musk to lift Starlink restrictions

https://www.bbc.com/news/articles/c6m25zg88k45o
6•tartoran•8m ago•0 comments

Did the SpaceX IPO Move the South Bay Housing Market?

https://www.realab.blog/p/did-the-spacex-ipo-move-the-south
2•dadepro•10m ago•0 comments

Memory management in 40 major C projects, a survey

https://theconsensus.dev/p/2026/11/08/c-memory-management-survey.html
3•theanonymousone•10m ago•0 comments

A2A (Agent2Agent) Protocol Is Fundamentally Flawed

https://masr.gitlab.io/blog/a2a-think-not/
2•ioper•11m ago•0 comments

Have Wages Kept Up with Housing Costs?

https://www.realab.blog/p/have-wages-kept-up-with-housing-costs
3•dadepro•11m ago•0 comments

Where ASI Could Stumble

https://www.lesswrong.com/posts/Jj2aLyZPYDv8ZsnCj/where-asi-could-stumble-1
1•MarkelKori•13m ago•0 comments

The Ghost in the Machine

https://www.scientificamerican.com/article/the-ghost-in-the-machine/
1•joebig•14m ago•0 comments

Show HN: Learn Piano Easy App – Free and Open Source

https://learn-piano-easy.app/
1•AnotherBrainFoo•14m ago•0 comments

Scammers stole his image to lure the lovesick. Then the lovesick came after him

https://apnews.com/article/scams-romance-fraud-investigation-victims-social-media-521ca3e4a7b3a58...
1•theanonymousone•14m ago•0 comments

Show HN: I wrote 100 SaaS ideas with buyer, pricing, and MVP plan for each

https://www.bestmillionstartups.com/100-saas-ideas
2•brevn•15m ago•0 comments

DuckDB might soon support more than 38 digits

https://github.com/duckdb/duckdb/pull/26955
2•I_am_tiberius•15m ago•1 comments

How AI will change engineering leadership in 2027

https://bjorg.bjornroche.com/management/ai-in-2027/
2•kurinikku•16m ago•0 comments

We handed our lives to closed software. AI is about to show us the cost

3•earlythesis•16m ago•0 comments

Learn You a Mischief for Great Good

https://hackage-content.haskell.org/package/mischief-ecs-0.2.1.0/docs/Mischief-ECS-Tutorial-Intro...
1•kreyenborgi•16m ago•0 comments

Ask HN: Why Didn't anyone design Infinite scroll for HN?

1•vishwakulkarni•17m ago•1 comments

Show HN: PongArena – Play Pong and see how tiny neural networks think

https://jonaslindblom.github.io/pongarena/
1•nrjl•19m ago•0 comments

The Oldest Text in the Training Data

https://www.lesswrong.com/posts/CzZR4ZcJoCNi2zqFn/the-oldest-text-in-the-training-data
1•ezrasu•19m ago•0 comments

Why Is China Shipping Jensen Huang? [video]

https://www.youtube.com/watch?v=gJGiApWDzjM
2•mgh2•19m ago•2 comments

The Riven Graph

https://glthr.com/riven-graph
3•glth•20m ago•0 comments

IPv6 delegation, an unusually subtle failure mode

https://savyasacheejha.com/posts/why-odhcpd/
2•genghizkhan•21m ago•0 comments

"Robots can't press call buttons": Hyundai tests API for robots using elevators

https://asia-tech-news.ghost.io/hyundai-elevator-testing-api-to-help-robots-use-elevators/
1•ilamont•21m ago•0 comments

Catch Go Bugs That Fuzzing Misses with Gemini and a Constraint Solver

https://developers.googleblog.com/en/catch-go-bugs-that-fuzzing-misses-with-gemini-and-a-constrai...
2•brandrick•22m ago•0 comments

NY AI Rules: Confidential Reports, Daily Fines, and a Kill Switch Wish List

https://reclaimthenet.org/new-york-raise-act-ai-registration-rules
1•zoobab•22m ago•0 comments

Show HN: Attest – Test what AI agents do, not just what they say

https://attest-framework.github.io/
3•tommathews•24m ago•0 comments

Witches, vampires, ancient aliens–you'll find them all in Malta

https://www.nationalgeographic.com/travel/article/explore-folklore-in-malta-witches-vampires-anci...
3•tosh•24m ago•0 comments

Show HN: Performance-driven terminal diff renderer

https://github.com/plannotator/diffs-rs
1•ramoz•24m ago•0 comments

Japan Develops Universal Artificial Blood (2025)

https://engineerine.com/japans-universal-artificial-blood/
2•thunderbong•27m ago•1 comments