-
-
Save baisa/21cdb3f1f751fb910f360b221f698918 to your computer and use it in GitHub Desktop.
go tour exercise, https://tour.golang.org/moretypes/18
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
package main | |
import "golang.org/x/tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
ret := make([][]uint8, dy) | |
for y := 0; y < dy; y++ { | |
row := make([]uint8, dx) | |
for x := 0; x < dx; x++ { | |
row[x] = uint8(y) | |
} | |
ret[y] = row | |
} | |
return ret | |
} | |
func main() { | |
pic.Show(Pic) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment