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.

LeMario: Training a JEPA World Model on Super Mario Bros

https://www.benjamin-bai.com/projects/lemario
1•kevinjosethomas•3m ago•0 comments

The Campaign to Kill American AI Runs Through San Francisco

https://garryslist.org/posts/the-campaign-to-kill-american-ai-runs-through-san-francisco
1•shinryudbz•6m ago•0 comments

The Chuwi MiniBook X N150

https://taoofmac.com/space/reviews/2025/05/15/2230
1•edward•6m ago•0 comments

Buffett omits gift to Bill Gates' foundation after his Epstein ties disclosed

https://www.theguardian.com/business/2026/jul/14/bill-gates-warren-buffet-donation
4•Teever•7m ago•0 comments

Kara Swisher: Important CEO straits [video]

https://www.youtube.com/watch?v=-d0kyPNFrVE
1•xqcgrek2•8m ago•0 comments

How Are "Disconnected" Young Adults Spending Their Time?

https://www.stlouisfed.org/on-the-economy/2026/jul/how-are-disconnected-young-adults-spending-the...
1•toomuchtodo•9m ago•0 comments

What to know about 'explosive diarrhoea' parasite outbreak in US

https://www.bbc.com/news/articles/c621m66qm76o
1•teleforce•12m ago•0 comments

Who Is America's Homer?

https://www.plough.com/articles/who-is-americas-homer
2•samclemens•14m ago•0 comments

Book Prizes Don't Work How You Think

https://rebeccamakkai.substack.com/p/book-prizes-dont-work-how-you-think
1•samclemens•14m ago•0 comments

Twain Town, USA

https://theamericanscholar.org/twain-town-u-s-a/
1•prismatic•15m ago•0 comments

Blocking internet on phones improves attention, mental health, and well-being

https://pubmed.ncbi.nlm.nih.gov/39967678/
2•gwintrob•15m ago•0 comments

Foglamp Scan

https://www.foglamp.dev/scan
1•handfuloflight•15m ago•0 comments

The Music of Destruction

https://thebaffler.com/latest/the-music-of-destruction-fuelling
1•lermontov•16m ago•0 comments

Intel's 18A node is officially space-grade

https://www.techpowerup.com/350713/intel-18a-silicon-goes-to-space-with-starfire-processors
1•hereme888•17m ago•0 comments

Show HN: DevQuest – live GitHub profile cards and a daily repository battle

https://github.com/yiaany/devquest
1•hizyyo•17m ago•1 comments

Understanding the Cost of Coding Agents

https://pub.towardsai.net/understanding-the-cost-of-coding-agents-9f4dc0f1e25e
2•allessa•17m ago•0 comments

Australian Government Establishes Office of AI

https://www.abc.net.au/news/2026-07-14/albanese-maps-out-ai-future-introducing-national-framework...
2•hulahoof•20m ago•0 comments

Improving Windows Search Box, with less clutter and more control

https://blogs.windows.com/windows-insider/2026/07/13/improving-windows-search-box-with-less-clutt...
2•quyleanh•23m ago•0 comments

Australia to become the first country to introduce landmark AI framework

https://www.sbs.com.au/news/article/australia-set-to-become-first-country-to-introduce-national-a...
1•defrost•23m ago•0 comments

Show HN: Mechacraft.io – Browser Vehicle Builder

https://mechacraft.io/
1•nickyvanurk•23m ago•0 comments

Immune Cells Get Transformed into Fungus-Fighting Nanoparticles

https://today.ucsd.edu/story/immune-cells-get-transformed-into-fungus-fighting-nanoparticles
1•gmays•23m ago•0 comments

OpenAI's first hardware device will be a portable desktop robot

https://www.machinesociety.ai/p/open-ais-first-hardware-device-will
2•mikelgan•24m ago•2 comments

Can humans hibernate their way to Mars?

https://www.theguardian.com/science/ng-interactive/2026/jul/14/human-hibernation-space-mars
1•howard941•24m ago•1 comments

Planning: A minimal Neovim planning calendar plugin

https://github.com/duguyue100/planning.nvim
1•duguyue100•28m ago•1 comments

Meontology

https://meontology.com/
1•cts-i-cts-d•29m ago•1 comments

The Last of the Three Amigos

https://www.theatlantic.com/ideas/2026/07/lindsey-graham-ukraine-russia/687898/
1•mpweiher•29m ago•0 comments

Satd: Bitcoin Streaming Event Consumption API

https://epochbtc.github.io/satd/streaming.html
1•epochbtc•31m ago•1 comments

Probably check on your smart appliances

https://xeiaso.net/notes/2026/check-your-smart-tv/
1•xena•33m ago•0 comments

L-Cysteine Vitamin Supplement Prevents or Alleviates Hangover Symptoms

https://pubmed.ncbi.nlm.nih.gov/32808029/
1•MrJagil•34m ago•0 comments

Financing the AI boom: from cash flows to debt [pdf]

https://www.bis.org/publ/bisbull120.pdf
8•1vuio0pswjnm7•35m ago•1 comments