frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

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.

Show HN: My OSINT dashboard with 60 feeds now has a pseudonymous P2P testnet

https://github.com/BigBodyCobain/Shadowbroker/tree/main
1•vancecookcobxin•21s ago•0 comments

Emacs: Save any buffer as PDF (my new buffer-to-pdf package)

https://protesilaos.com/codelog/2026-05-02-emacs-buffer-to-pdf-new-package/
1•dalvrosa•4m ago•0 comments

GSoC2026: What to expect (image editing, animation, 3D, and engineering)

https://librearts.org/2026/04/gsoc2026-projects/
1•prokoudine•4m ago•0 comments

Have online worlds become the last free places for children?

https://psyche.co/ideas/have-online-worlds-become-the-last-free-places-for-children
2•paulpauper•6m ago•0 comments

Stop Begging Extension for LibreOffice

https://extensions.libreoffice.org/en/extensions/show/867
1•mmarian•6m ago•1 comments

Should we be scared of China's surpluses?

https://jzmazlish.substack.com/p/should-we-be-scared-of-chinas-surpluses
1•paulpauper•6m ago•0 comments

AI music is flooding streaming services – but who wants it?

https://www.theverge.com/column/921599/ai-music-is-flooding-streaming-services-but-who-wants-it
1•Brajeshwar•7m ago•0 comments

Five Banana Lessons

https://allensthoughts.com/2026/05/03/five-banana-lessons/
2•herbertl•7m ago•0 comments

Lilly, AI biotech Profluent ink $2.25B pact in search of genetic 'holy grail'

https://www.biospace.com/deals/lilly-ai-biotech-profluent-ink-2-25b-pact-in-search-of-genetic-med...
1•gmays•8m ago•0 comments

Porsche will contest Laguna Seca in historic colors of the Apple Computer livery

https://newsroom.porsche.com/en_US/2026/motorsport/porsche-will-contest-laguna-seca-in-historic-c...
1•Amorymeltzer•9m ago•0 comments

Some Important Numbers for Developers (2018)

http://russolsen.com/articles/2018/04/25/some-important-numbers-for-developers.html
2•chalmovsky•9m ago•0 comments

The world's longest railway tunnel is being built under the Alps

https://www.euronews.com/my-europe/2026/05/01/world-record-made-in-europe-the-worlds-longest-rail...
1•vrganj•16m ago•0 comments

Ask HN: Tips for Longevity, as a Software Engineer

1•2bird3•19m ago•0 comments

Modern jet engine turbines: each blade a single crystal (2015)

https://www.americanscientist.org/article/each-blade-a-single-crystal
1•whycome•20m ago•0 comments

Ask HN: Please, I need your help to try out an iOS app I work on

1•erosa01•20m ago•2 comments

Alert-Driven Monitoring

https://simpleobservability.com/docs/alert-driven-monitoring
1•khazit•20m ago•0 comments

ImagePrint 1.52 Released

https://www.imageprint.io/blog/whats-new-in-imageprint-1-52/
1•coragi•22m ago•0 comments

CPU Work and GPU Work

https://www.talhoffman.com/2026/05/03/cpu-work-and-gpu-work/
2•talhof8•25m ago•0 comments

Fisheries and Aquaculture

https://www.oecd.org/en/topics/fisheries-and-aquaculture.html
1•mooreds•26m ago•0 comments

Show HN: Hello, World in many different languages

https://languages.jdunn.dev/
2•jdironman•28m ago•2 comments

NOAA forecaster on how this year's El Niño could shatter records

https://www.livescience.com/planet-earth/weather/one-of-the-most-rapid-transitions-that-ive-seen-...
2•ukz•28m ago•0 comments

I Have Lived in Your Camp

https://green.spacedino.net/i-have-lived-in-your-camp/
1•mooreds•30m ago•0 comments

The Petroleum System Is Entering Its Volatile Decline Phase

https://cleantechnica.com/2026/04/29/the-petroleum-system-is-entering-its-volatile-decline-phase/
1•xbmcuser•31m ago•0 comments

Company said I could move and then changed their mind

https://www.askamanager.org/2026/04/company-said-i-could-move-and-then-changed-their-mind-how-do-...
2•mooreds•35m ago•0 comments

Show HN: I made a simulator for personal finance (5 year update)

https://projectionlab.com/
1•scubakid•36m ago•0 comments

Custom Voices and Voice Library

https://x.ai/news/grok-custom-voices
1•tjek•39m ago•0 comments

I'm a late arrival to short-form video – its effect on my life has shocked me

https://www.theguardian.com/commentisfree/2026/may/03/algorithm-short-form-video-overload
3•andsoitis•40m ago•0 comments

Sandwich Theorem

https://en.wikipedia.org/wiki/Squeeze_theorem
1•_Microft•43m ago•0 comments

Pipelight

https://pipelight.dev/
1•fulafel•44m ago•0 comments

After giving away $26B MacKenzie Scott's wealth remains largely unchanged

https://timesofindia.indiatimes.com/world/us/after-giving-away-26-billion-in-philanthropy-mackenz...
1•gscott•44m ago•0 comments