Range loop pitfalls (#30-32)
Official 100go coverage of mistakes #30-32; the anchor points at #30 but the page section also covers range evaluation and pointer-related loop pitfalls.
Official 100go coverage of mistakes #30-32; the anchor points at #30 but the page section also covers range evaluation and pointer-related loop pitfalls.
- Author: Teiva Harsanyi
- Authority: community
- Kind: guide
- URL: https://100go.co/#ignoring-that-elements-are-copied-in-range-loops-30
What it covers
- range value copying
- range expression evaluation
- pointer and loop-variable traps
Why authoritative
Official 100go website entries for related range-loop mistakes.
Use when
- how do range loops behave in Go
- does this range loop copy values
- what range loop pitfalls should I watch for
Keywords
- range loops, copied values, loop variables, arrays, pointers