Created
December 8, 2019 17:21
-
-
Save siisee11/3cc4dfe9529d7517743bf288e8acfae4 to your computer and use it in GitHub Desktop.
A tour of Go exercise2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://gist.github.com/tetsuok/2280162#gistcomment-2893594