Created
June 24, 2013 18:00
-
-
Save slawosz/5852093 to your computer and use it in GitHub Desktop.
Go pictures
This file contains hidden or 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
// http://tour.golang.org/#35 | |
package main | |
import "code.google.com/p/go-tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
picture := make([][]uint8, dx) | |
for i := 0; i < dx; i++ { | |
picture[i] = make([]uint8, dy) | |
} | |
for i := 1; i < dx; i++ { | |
for j := 1; j < dy; j++ { | |
picture[i][j] = uint8(i + j) | |
} | |
} | |
return picture | |
} | |
func main() { | |
pic.Show(Pic) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment