Skip to content

Instantly share code, notes, and snippets.

@evandertino
Last active August 29, 2015 14:18
Show Gist options
  • Select an option

  • Save evandertino/d01d13665b7d7a210727 to your computer and use it in GitHub Desktop.

Select an option

Save evandertino/d01d13665b7d7a210727 to your computer and use it in GitHub Desktop.
Go Exercise: Slices - http://tour.golang.org/moretypes/14
package main
import "golang.org/x/tour/pic"
func Pic(dx, dy int) [][]uint8 {
slc := make([][]uint8, dy)
for x := range slc {
slc[x] = make([]uint8, dx)
for y := range slc[x] {
// Create equations below
eq1 := (x + y) / 2
//eq2 := x * y
//eq3 := x ^ y
//eq4 := (x ^ y) * (x ^ y)
slc[x][y] = uint8(eq1)
}
}
return slc
}
func main() {
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment