Skip to content

Instantly share code, notes, and snippets.

@pixyj
Last active December 19, 2015 08:49
Show Gist options
  • Save pixyj/5928747 to your computer and use it in GitHub Desktop.
Save pixyj/5928747 to your computer and use it in GitHub Desktop.
A tour of Go # 35 Straight line with slope == 1
import "fmt";
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
phew := make([][]uint8, dx)
for i := range phew {
phew[i] = make([]uint8, dy)
for j := range phew[i] {
z := i + j;
phew[i][j] = uint8(z)
}
}
return phew
}
func main() {
fmt.Println(Pic(4, 5))
pic.Show(Pic)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment