Skip to content

Instantly share code, notes, and snippets.

@waddles
Created February 11, 2015 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save waddles/3fafadef2dacdb4d62de to your computer and use it in GitHub Desktop.
Save waddles/3fafadef2dacdb4d62de to your computer and use it in GitHub Desktop.
Go Tour Exercise on Slices - http://tour.golang.org/moretypes/14
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
a := make([][]uint8, dy)
for y := 0; y < dy; y++ {
a[y] = make([]uint8, dx)
for x := 0; x < dx; x++ {
a[y][x] = uint8((x^y) * (x^y))
}
}
return a
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment