Skip to content

Instantly share code, notes, and snippets.

@amstee
Last active January 15, 2017 00:08
Show Gist options
  • Select an option

  • Save amstee/aff03c7b0eb6b40c60911a6419434472 to your computer and use it in GitHub Desktop.

Select an option

Save amstee/aff03c7b0eb6b40c60911a6419434472 to your computer and use it in GitHub Desktop.
An answer for the exercise slices
func Pic(dx, dy int) [][]uint8 {
pic := make([][]uint8, dy)
for i := 0; i < dy; i++ {
pic[i] = make([]uint8, dx)
for u := 0; u < dx; u++ {
pic[i][u] = uint8((u + i) / 2)
}
}
return pic
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment