All:
When I try to follow golang's Tour of Go:
My code is like this:
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
const x = dx
const y = dy
pic := [y][x]uint8{};
for r:=range pic {
row := pic[r]
for c := range row {
row[c] = uint8(c*r)
}
}
return pic[:]
}
func main() {
pic.Show(Pic)
}
And I got error like:
prog.go:6:8: const initializer dx is not a constant
prog.go:7:8: const initializer dy is not a constant
I am pretty new to Go, I wonder what this error means, and if I want to build an array first(other than using make() to build slice), how can I pass the length of array?