Go array range 02
2019-03-08 本文已影响0人
JaedenKil
package main
import "fmt"
func main() {
pow := make([]int, 10)
for index := range pow { // Drop ", value" totally, only cares about index
fmt.Println(index)
}
fmt.Println("------") // Ignore index, cares about value
for _, value := range pow {
fmt.Printf("%d\n", value)
}
}
0
1
2
3
4
5
6
7
8
9
------
0
0
0
0
0
0
0
0
0
0