Go

Range Over Slice in Go

GoControl FlowRangebeginner

range yields the index and a copy of the element. Use _ for the index when you only care about values.

expected output

0:Go 1:Rust 2:Zig 

Why practise typing this

Typing control flow code builds muscle memory for the symbols and indentation Go uses most, which prose-based typing tests never cover. DevType measures your words per minute and accuracy on this snippet and tracks the individual characters you mistype, so later lessons can target them.

More Go practice

Browse all Go snippets →