...

/

Solution: Multidimensional Array

Solution: Multidimensional Array

Let's look at the solution.

We'll cover the following...

Solution

Press + to interact
package main
import "fmt"
const (
width = 34
height = 11
gopher = " ,_---~~~~~----._ _,,_,*^____ _____``*g*\\'*, / __/ /' ^. / \\ ^@q f[ @f | @)) | | @)) l 0 _/ \\`/ \\~____ / __ \\_____/ \\ | _l__l_ I } [______] I ] | | | | ] ~ ~ | | | | | "
)
func getCharacterAt(array2d string, x, y, width int) string {
return string(array2d[width*y+x])
}
func main() {
for y := 0; y < height; y++ {
for x := 0; x < width; x++ {
fmt.Print(
getCharacterAt(gopher, x, y, width))
}
fmt.Println()
}
}

Explanation

In ...