Skip to content

Instantly share code, notes, and snippets.

@oldergod
Created September 11, 2014 15:00
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 oldergod/3b2216c2fedc69148d9d to your computer and use it in GitHub Desktop.
Save oldergod/3b2216c2fedc69148d9d to your computer and use it in GitHub Desktop.
Tour of Go Slices
package main
import (
"code.google.com/p/go-tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
top := make([][]uint8, dy)
for i := range top {
top[i] = make([]uint8, dx)
for j := range top[i] {
top[i][j] = uint8((i ^ j) * (i ^ j))
}
}
return top
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment