Go array range
2019-03-08 本文已影响0人
JaedenKil
package main
import "fmt"
func main() {
var pow = []int{1, 2, 4, 8, 16, 32}
for index, value := range pow {
fmt.Printf("2**%d = %d\n", index, value)
}
}
2**0 = 1
2**1 = 2
2**2 = 4
2**3 = 8
2**4 = 16
2**5 = 32