Skip to content

Instantly share code, notes, and snippets.

@siisee11
Created December 8, 2019 17:21
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 siisee11/3cc4dfe9529d7517743bf288e8acfae4 to your computer and use it in GitHub Desktop.
Save siisee11/3cc4dfe9529d7517743bf288e8acfae4 to your computer and use it in GitHub Desktop.
A tour of Go exercise2
package main
import (
"code.google.com/p/go-tour/pic"
)
func Pic(dx, dy int) [][]uint8 {
image := make([][]uint8, dy)
for i := range(image) {
image[i] = make([]uint8, dx)
}
for i := 0 ; i < dy; i++ {
for j := 0 ; j < dx; j++ {
image[i][j] = uint8( i + j )
}
}
return image
}
func main() {
pic.Show(Pic)
}
@siisee11
Copy link
Author

siisee11 commented Dec 8, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment