Solution Review: Filling Array with Loop Counter
This lesson discusses the solution to the challenge given in the previous lesson.
We'll cover the following...
We'll cover the following...
Go (1.6.2)
package mainimport "fmt"func main() {var arr [15]intfor i:=0; i < 15; i++ { // counter-controlled looparr[i] = i}fmt.Println(arr) // [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14]}
As you can see, in main at line 5 we declare an array arr with length 15. We set the length to 15 ...