Skip to content

Instantly share code, notes, and snippets.

@raypereda
Created April 2, 2014 04:35
Show Gist options
  • Save raypereda/9927988 to your computer and use it in GitHub Desktop.
Save raypereda/9927988 to your computer and use it in GitHub Desktop.
practice using arrays in go
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
pic := make([][]uint8, dy)
for i, _ := range pic {
pic[i] = make([]uint8, dx)
for j := 0; j < dy; j++ {
pic[i][j] = uint8(i*j)
}
}
return pic
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment