go-tour/exercise-slices.go

19 lines
311 B
Go
Raw Normal View History

2020-02-05 03:44:36 +00:00
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)
}