Created
September 25, 2018 00:38
-
-
Save jchung05/8b61b9207198f1acd454bfa6af9ff5e3 to your computer and use it in GitHub Desktop.
An attempt at the A Tour of Go Slices exercise
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 { | |
arr := make([][]uint8, dy) | |
for i := range arr { | |
arr[i] = make([]uint8, dx) | |
for j:= range arr[i] { | |
arr[i][j] = uint8((i + j) / 2) | |
} | |
} | |
return arr | |
} | |
func main() { | |
pic.Show(Pic) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment