Skip to content

Instantly share code, notes, and snippets.

@Medeah
Created March 10, 2013 08:07
Show Gist options
  • Save Medeah/5127581 to your computer and use it in GitHub Desktop.
Save Medeah/5127581 to your computer and use it in GitHub Desktop.
A Tour of Go 35: Exercise: Slices
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
slicePic := make([][]uint8, dy)
for y := range slicePic {
slicePic[y] = make([]uint8, dx)
for x := range slicePic[y] {
slicePic[y][x] = uint8(x ^ y)
}
}
return slicePic
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment