Slice exercise with the blue and white picture!
This commit is contained in:
parent
e48569cc70
commit
d23bfcc869
20
gotime/src/exercise-slices.go
Normal file
20
gotime/src/exercise-slices.go
Normal file
@ -0,0 +1,20 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"code.google.com/p/go-tour/pic"
|
||||
)
|
||||
|
||||
func Pic(dx, dy int) [][]uint8 {
|
||||
cols := make([][]uint8, dy)
|
||||
for i := range cols {
|
||||
cols[i] = make([]uint8, dx)
|
||||
for j := range cols[i] {
|
||||
cols[i][j] = uint8(j^i)
|
||||
}
|
||||
}
|
||||
return cols
|
||||
}
|
||||
|
||||
func main() {
|
||||
pic.Show(Pic)
|
||||
}
|
Loading…
Reference in New Issue
Block a user