go-tour/exercise-slices.go
2020-02-04 21:44:36 -06:00

19 lines
311 B
Go

package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
pic := make([][]uint8, dy)
for y := range pic {
pic[y] = make([]uint8, dx)
for x := range pic[y] {
pic[y][x] = uint8(x) ^ uint8(y)
}
}
return pic
}
func main() {
pic.Show(Pic)
}