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.

Four Ex-Stratfor Analysts Reunite to Predict How the World Ends [video]

https://www.youtube.com/watch?v=z9zH8CJTPS8
1•mooreds•2m ago•0 comments

Show HN: Discover and Compare the Best Software Tools – GeeksDive

https://geeksdive.com
1•not_wowinter13•3m ago•0 comments

EU Regulators Barred from Disclosing Tesla FSD Approval Research

https://www.reuters.com/legal/litigation/pressured-by-tesla-european-regulators-keep-full-self-dr...
1•qprofyeh•3m ago•1 comments

Win a Copy of Mastering Digital Identity

https://ciamweekly.substack.com/p/want-to-win-a-copy-of-mastering-digital
1•mooreds•5m ago•0 comments

Navigating Private Equity ownership (2024)

https://lethain.com/private-equity-strategy/
1•mooreds•5m ago•0 comments

The Hottest New AI Chatbot Is Just a Guy Answering Your Questions

https://www.wired.com/story/this-chatbot-is-just-a-random-guy-lol/
3•joozio•7m ago•0 comments

Making Postgres 300x faster for analytics: batching, operator fusion, and SIMD

https://malisper.me/how-we-made-postgres-hundreds-of-times-faster-the-query-engine/
1•poly2it•8m ago•0 comments

Marp now supports Mermaid diagrams

https://github.com/marp-team/marp-core/blob/main/docs/markdown.md
1•jamesbelchamber•9m ago•0 comments

How to Not Write Parsers

https://crtschin.com/posts/how-to-not-write-parsers
1•Thom2503•11m ago•0 comments

Show HN: We automated reading and filtering competitor website changes

https://competitortracker.io
2•slobodan_•12m ago•1 comments

Meta apologises to India for restricting PM Modi's post

https://www.reuters.com/world/india/meta-apologises-india-restricting-pm-modis-post-2026-08-05/
3•thisislife2•14m ago•0 comments

From constraint models to playable puzzle games

https://zayenz.se/blog/post/constraint-generated-puzzle-games/
1•mzl•15m ago•0 comments

Airworthiness Directive: Cracks in Fuselage of Boeing 737-8, 737-9, and 737-8200

https://www.federalregister.gov/documents/2026/08/06/2026-15936/airworthiness-directives-the-boei...
2•impish9208•15m ago•0 comments

New Intelligence Warns Russia May Provoke NATO Amid Dwindling U.S. Munitions

https://www.wsj.com/finance/investing/new-intelligence-warns-russia-may-provoke-nato-amid-dwindli...
1•doener•16m ago•0 comments

Our world is full of slop

https://refactoringorgs.com/ramblings/world-full-of-slop.php
1•polocode•16m ago•1 comments

Show HN: textlog – A quiet, text-only microblogging platform

https://textlog.cc/about
2•stagas•16m ago•0 comments

Ask HN: Is there an AI app that generates a feed of personalized cheat sheets

1•ElegantTrader•18m ago•0 comments

Claude Code skill allowing orchestration of edits beat-synced to songs

https://github.com/ZiadAbdelkarim/beat-synced-edit
1•iwasastreamer•19m ago•0 comments

Ask HN: Alternatives to Hotline Telegram CRM?

1•hotline•20m ago•0 comments

Loop Engineering in Claude

https://claude.com/blog/getting-started-with-loops
2•abrbhat•23m ago•0 comments

An explosion of new AI-written genealogy tree tools

https://blog.dnapainter.com/blog/an-explosion-of-new-tree-tools/
1•vintermann•24m ago•0 comments

Build a crappy ring-0 toy antivirus in eBPF with the IMA LSM

https://blog.prizrak.me/post/ima/
1•razighter777•24m ago•0 comments

Kitesurf: Agent-first browser that runs in V8 isolates

https://blog.cloudflare.com/kitesurf/
3•m3h•27m ago•0 comments

Crubit: C++/Rust Bidirectional Interop Tool Rust Workflow

https://crubit.rs/
1•zombot•30m ago•0 comments

Bulldozers Plow Through Big Bend National Park, Sparking Fury in Texas

https://www.newsweek.com/bulldozers-plow-through-big-bend-national-park-sparking-fury-in-texas-12...
1•almog•36m ago•0 comments

US strikes $1.2B deal to pay German firm to halt offshore wind projects

https://www.bbc.com/news/articles/c1e1vg0gjl5o
71•defrost•40m ago•36 comments

Sonic Pi v5 Released

https://www.patreon.com/samaaron/posts/sonic-pi-v5-166001392
2•samaaron•42m ago•1 comments

Kalshi and Polymarket bets on clinical trials criticized as 'ghastly'

https://text.npr.org/nx-s1-5922530
2•1659447091•46m ago•0 comments

HeroBot

https://herobot.co/
1•ingersol•46m ago•0 comments

Notes Compound, Blogs Compile: When I Update a Note vs. Publish a Post

https://www.ssp.sh/brain/sharing-as-second-brain-note-vs-a-blog-post/
2•zazuke•47m ago•0 comments