I was debugging and added "fmt" package just to add some prints for the values in the matrix and seeing if I was initializing it correctly. When you have the package imported, the pic is not displayed properly. I think adding a note would be great.
`package main
import (
"golang.org/x/tour/pic"
"fmt"
)
func Pic(dx, dy int) [][]uint8 {
mat := make([][]uint8, dy)
fmt.Println(mat)
for i := range mat {
mat[i] = make([]uint8, dx)
}
for i := range mat {
for j := range mat[i] {
mat[i][j] = uint8(i^j)
}
}
return mat
Context: https://go.dev/tour/moretypes/18
I was debugging and added "fmt" package just to add some prints for the values in the matrix and seeing if I was initializing it correctly. When you have the package imported, the pic is not displayed properly. I think adding a note would be great.
`package main
import ( "golang.org/x/tour/pic" "fmt" )
func Pic(dx, dy int) [][]uint8 { mat := make([][]uint8, dy) fmt.Println(mat) for i := range mat { mat[i] = make([]uint8, dx) }
}
func main() { pic.Show(Pic) } `