package main
import "golang.org/x/tour/pic"
array = [][]uint8
func Pic(dx, dy int) [][]uint8 {
for i:=0; i < dy; i++ {
array[i] = dx
}
return array
}
func main() {
pic.Show(Pic)
}
func Pic(dx, dy int) [][]uint8 {
result := make([][]uint8, dy)
for i := range result {
result[i] = make([]uint8, dx)
}
for i := range result {
for j := range result[i] {
result[i][j] = uint8((i + j) / 2)
}
}
return result
}
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
array := make([][]uint8, dy)
for y := 0; y < dy; y++ {
array[y] = make([]uint8, dx)
for x := 0; x < dx; x++ {
pixel := uint8((x + y) / 2)
array[y][x] = pixel
}
}
return array
}
func main() {
pic.Show(Pic)
}