Loops
Learn about loops in Go.
We'll cover the following
range
iterator returns two values
A trap for early beginners is that for-range
in Go works a bit
differently than its equivalents in other languages. It returns one or
two variables: the first of those two is an iteration index (or a map
key if a map
is iterated on) and second is the value. If only one variable is used, then it’s the index:
Get hands-on with 1400+ tech skills courses.