Solution Review: Filling Array with Loop Counter

This lesson discusses the solution to the challenge given in the previous lesson.

Press + to interact
package main
import "fmt"
func main() {
var arr [15]int
for i:=0; i < 15; i++ { // counter-controlled loop
arr[i] = i
}
fmt.Println(arr) // [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14]
}

Get hands-on with 1400+ tech skills courses.