Skip to content

Comment on Go Herculeparent

Comments

axkOP

It's not always logic bugs. For example, here's how you would limit your slice to max N elements:

    arr = arr[:N]
...compared how it has to be done to avoid a panic:
    if len(arr) > N {
        arr = arr[:N]
    }
Not a big deal though, just slightly more verbose.
AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.