Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tour: Exercise: Slices #481

Open
dijonkitchen opened this issue May 16, 2018 · 2 comments
Open

tour: Exercise: Slices #481

dijonkitchen opened this issue May 16, 2018 · 2 comments

Comments

@dijonkitchen
Copy link

dijonkitchen commented May 16, 2018

Context: https://tour.golang.org/moretypes/18

x and y need to be clarified that they are the indices for the two for-loops. This is particularly confusing with the dx and dy parameters in the Pic function.

Example:

package main

import "golang.org/x/tour/pic"

func Pic(dx, dy int) [][]uint8 {
	pixels := make([][]uint8, dy)
	for x := 0; x < len(pixels); x++ {
		pixels[x] = make([]uint8, dx)
		for y := 0; y < len(pixels[x]); y++ {
			pixels[x][y] = (uint8(x) ^ uint8(y))
		}
	}
	return pixels
}

func main() {
	pic.Show(Pic)
}
@lzantal
Copy link

lzantal commented Jul 29, 2019

I just asked on twitter about this. How did you get to that solution? I was staring at it for 10 min and had no clue what it is asking me to do.

@dijonkitchen
Copy link
Author

Yeah, that's why I made this issue. I think the problem should be clarified because it's confusing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants