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.

US to fund new research into psychedelic drug ibogaine for veterans with PTSD

https://www.reuters.com/legal/litigation/us-fund-new-research-into-psychedelic-drug-ibogaine-vete...
1•bushwart•1m ago•0 comments

Who's making all of the money in the porn industry? [video]

https://www.youtube.com/watch?v=3IsgwsuV_nE
1•AareyBaba•4m ago•0 comments

Eight years of running DocSpring on Convox

https://docspring.com/blog/posts/eight-years-running-docspring-convox/
1•nathan_f77•6m ago•0 comments

Show HN: Podcast News

https://podnews.app
1•nsemikey•19m ago•0 comments

Naughty Dog's Lisp-Based Game Engines [video]

https://www.youtube.com/watch?v=RXdI2o0yplY
2•s20n•20m ago•0 comments

Ferrari's Business Model Is Insane

https://www.tradingview.com/chart/RACE/awwoRgDb-RACE-Why-Ferrari-Is-Nothing-Like-Other-Car-Manufa...
1•moonypto•27m ago•0 comments

Monkey Island: all 13 versions side by side

https://monkeyisland.pages.dev/
1•maximilianburke•29m ago•0 comments

Tmux Floating Panes (v3.7)

https://tmuxcheatsheet.com/p/tmux-floating-panes/
1•mmh0000•32m ago•0 comments

Where Work Experience Can Fail

https://carlsonschool.umn.edu/news/where-work-experience-can-fail
1•rohanm93•35m ago•0 comments

Sick of Herding AI Cats?

https://clowder.sh
1•cat_herder_1•39m ago•1 comments

A rusty smudge: What will happen as the Titanic wreck disintegrates (2024)

https://www.bbc.com/future/article/20240903-the-titanic-why-is-it-disintegrating-and-how-long-wil...
1•thunderbong•42m ago•0 comments

Home Sales in October Plummet to 16-Year Low

https://www.wsj.com/economy/housing/home-sales-in-october-plummet-to-16-year-low-16adebc0
1•madihaa•49m ago•0 comments

Keeping video layers in place across aspect ratios

https://blog.breatic.ai/layers-across-aspect-ratios/
1•Ubiquition•51m ago•0 comments

Elon should hire Jensen to run Terafab

1•spottedmarley•51m ago•1 comments

What Are Metal Organic Frameworks (MOFs)?

https://www.ossila.com/pages/what-are-metal-organic-frameworks
1•peter_d_sherman•51m ago•1 comments

Searching for exotic scalars at fusion reactors (2025)

https://arxiv.org/abs/2502.12314
1•greesil•53m ago•0 comments

Pax Silica

https://en.wikipedia.org/wiki/Pax_Silica
1•jonbaer•54m ago•1 comments

Run Cloudflare Workers Anywhere

https://openorange.dev/
1•madars•54m ago•0 comments

Dusk OS Sales Pitch

https://duskos.org/why.html
1•vermilingua•56m ago•0 comments

Ask HN: What use are the non-major cryptocurrencies?

1•otohp•59m ago•0 comments

Neuron turns model into conspiracy theorist

https://x.com/StationhouseAI/status/2121393278407123388
1•stationhouse•1h ago•0 comments

MathHelm: A Place to discuss AI-generated papers

https://mathhelm.org/
3•iLuddite•1h ago•0 comments

Israel's VCs see opportunity for challengers in Nvidia's turmoil

https://techcrunch.com/2026/11/13/israels-vcs-see-opportunity-for-challengers-in-nvidias-turmoil/
3•sjdh76•1h ago•0 comments

An open letter to the Nvidia Board of Directors

https://standwithjensen.com/#letter
3•gmays•1h ago•2 comments

Agent Distraction

https://developers.googleblog.com/agent-distraction/
2•pykello•1h ago•0 comments

Faster Scientific Simulations with New FP64 Algorithms in Nvidia cuBLAS

https://developer.nvidia.com/blog/faster-scientific-simulations-with-new-fp64-algorithms-in-nvidi...
1•qainsights•1h ago•0 comments

Show HN: Back endskills – agent skills for safer auth, data and migration code

https://github.com/globalmpc/backendskills
2•bayarkhuu5155•1h ago•0 comments

Cancer society issues updated prostate cancer screening guidelines

https://abcnews.com/GMA/Wellness/cancer-society-issues-specific-prostate-cancer-screening-guideli...
4•gmays•1h ago•0 comments

Ask HN: OpenAI Astra post-launch slump?

1•iJohnDoe•1h ago•2 comments

Obscura is so obscure it is practically unique

https://chronicles.mad-scientist.club/tales/obscure-obscura-is-actually-unique/
2•CqtGLRGcukpy•1h ago•2 comments