Created
October 23, 2015 03:27
-
-
Save mayra-cabrera/0495d8f80503f5219262 to your computer and use it in GitHub Desktop.
Exercise slices from golang tour
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 { | |
z := make([][]uint8, dy) | |
for i := range z { | |
z[i] = make([]uint8, dx) | |
for j := range z[i]{ | |
z[i][j] = uint8(i^j+(i+j)/2) | |
} | |
} | |
return z | |
} | |
func main() { | |
pic.Show(Pic) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment