Skip to content

Comment on Go Herculeparent

Comments

The idea is it's `for k := range object` to iterate over the keys, and `for k, v := range object` to iterate over the keys and values, whether the object is a slice, array, map or string. The only exceptional case is a channel, which has no indices/keys.

axkOP

It does make perfect sense, just goes against muscle memory from years of Python coding :)

AboutSource Built by g1lg1l

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