Skip to content

Instantly share code, notes, and snippets.

@samv
Created January 27, 2011 05:17
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 samv/798104 to your computer and use it in GitHub Desktop.
Save samv/798104 to your computer and use it in GitHub Desktop.
slices example
package main
import "tour/pic"
func Pic(dx, dy int) [][]uint8 {
var rv = make([][]uint8, dy)
for y := 0; y < dy; y++ {
rv[y] = make([]uint8, dx);
for x := 0; x < dx; x++ {
rv[y][x] = uint8(x + y);
}
}
return rv;
}
func main() {
pic.Serve(Pic);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment