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.

My CTF Setup: BlackArch in Docker

https://coding-overhead.com/posts/blackarch-docker/
1•ismd•2m ago•0 comments

Game theory's cure for corruption (2015)

https://aeon.co/essays/game-theory-s-cure-for-corruption-make-us-all-cops
1•sammatilda•5m ago•0 comments

EUVD-2024-5409 Synology and Beestation – Improper Encoding or Escaping of Output

https://euvd.enisa.europa.eu/vulnerability/EUVD-2024-54098
1•austinallegro•6m ago•0 comments

The New Mind Control – The internet has spawned subtle forms of influence (2016)

https://aeon.co/essays/how-the-internet-flips-elections-and-alters-our-thoughts
1•sammatilda•6m ago•0 comments

DeepMind Employees Are Unionising

https://www.gdmunion.co.uk
1•nervai•8m ago•0 comments

Where do we go from here?

https://nicolasbouliane.com/blog/life-after-ai
1•nicbou•9m ago•0 comments

How to Create a Virtual Background Using the Red5 WebRTC SDK

https://www.red5.net/blog/virtual-backgrounds-using-the-red5-webrtc-sdk/
1•mondainx•10m ago•0 comments

What's New in PHP 8.6

https://www.php.net/releases/8.6/en.php
1•netol•10m ago•0 comments

The gas pipeline where Ukraine is fighting an underground war with Russia

https://www.bbc.com/news/videos/c8p3vw4q6nzzo
2•ZeljkoS•12m ago•0 comments

Placky Explains Slide Rules (2021)

https://randomlyunique.com/plancky/2021/slide-rules/index.html
1•kqr•18m ago•0 comments

SoduWork – Open-source workbench where agents must prove their work

https://github.com/mdiri-ai/SoduWork
1•WavyPeng•19m ago•0 comments

There's a New Disruptor Throwing Terrible AI Slop at Sports Fans

https://defector.com/theres-a-new-disruptor-throwing-terrible-ai-slop-at-sports-fans
1•abbadadda•19m ago•0 comments

Deadweight: What your Claude Code setup costs on every request

https://github.com/msertdev/deadweight
1•msertdev•23m ago•0 comments

Binaryen – compiler and toolchain library for WebAssembly, written in C++

https://github.com/webassembly/binaryen
1•peter_d_sherman•23m ago•1 comments

I Don't Read Code Anymore [video]

https://www.youtube.com/watch?v=RO52GyQQMKg
2•zwischenzug•25m ago•0 comments

Florida man sentenced to 60 months for distributing monkey torture videos

https://www.justice.gov/opa/pr/miami-area-man-sentenced-60-months-prison-distributing-sexual-tort...
2•illidan1000•29m ago•1 comments

Ruby2ẞhell blog by one of the reporters

https://durendal.sh/blog/ruby-case-mapping-bugs
1•realansgar•30m ago•0 comments

Who Made the Strawberry?

https://strawberry-methodology.pages.dev/
1•DeepLogin•32m ago•0 comments

SSD prices will start going down the second half of next year

https://www.drivevault.io/blog/when-will-hard-drive-prices-come-down.html
12•illidan1000•32m ago•5 comments

NGINX2Root: Remote Code Execution vulnerabilities in Nginx

https://lwn.net/Articles/1108362/
4•bashhq_r•33m ago•0 comments

Taylor Swift's favorite restaurants and hotels

https://wherecelebsgo.com/people/taylor-swift
2•ispotcelebs•34m ago•2 comments

Show HN: Drisp – put app screenshots on true-size 3D device models

https://drint.io/drisp
2•Dan96•35m ago•0 comments

The Hidden Geography of AI [video]

https://www.youtube.com/watch?v=K-qll_Yhfms
2•jonbaer•40m ago•0 comments

Do not buy RAM, compress

https://curiousbits.nl/blog/do-not-buy-ram-compress/
5•Ecno92•40m ago•2 comments

Telegram Dictator

https://macos-beta.telegram.org/dictator/
2•SweetSoftPillow•41m ago•0 comments

ICE offers contractor operating deportation flights windfall and secrecy

https://www.theguardian.com/us-news/2026/nov/18/ice-deportation-flights-csi-deal
2•rob74•41m ago•0 comments

AI found more critical bugs in another widely used tech running 225M websites

https://www.theregister.com/security/2026/11/18/ai-found-more-critical-bugs-in-another-widely-use...
2•nephihaha•42m ago•0 comments

0.87.0 – Boot without the card, and a KVM switch – ESP-KVM

https://espkvm.io/blog/0-87-0-boot-without-the-card/
2•dexif•44m ago•0 comments

EU commission hit by cyber attack

https://en.philenews.com/international/european-commission-cyberattack-personal-data-staff-system...
3•lode•47m ago•0 comments

Bloom Exchange – Double-blind negotiation sandbox and Ed25519 receipts for MCP

https://github.com/astyboyy-ship-it/bloom-exchange
1•BloomExchangeAi•47m ago•0 comments