Someone showed me an interesting use of range
in Go to iterate a set number of times. Lets say you want to print out the numbers from 0 to 9. Instead of writing for i := 0; i <= 9; i++
, you can simply do the following:
for i := range 10 {
fmt.Println(i)
}
Really nice touch.