Created
August 12, 2017 04:10
-
-
Save brianjester/2bd84c828f3f4aed9723f8d5450be260 to your computer and use it in GitHub Desktop.
A Tour of Go - Exercise: Slices
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 "golang.org/x/tour/pic" | |
func Pic(dx, dy int) [][]uint8 { | |
mypic := make([][]uint8, dy) | |
for i := 0; i < dy; i++ { | |
mypic[i] = make([]uint8, dx) | |
for j := 0; j < dx; j++ { | |
mypic[i][j] = uint8((i*j)^i-j) | |
} | |
} | |
return mypic | |
} | |
func main() { | |
pic.Show(Pic) | |
} |
Author
brianjester
commented
Aug 12, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment