I am having trouble to pass a slice of a 2d array of strings inside a func : this is my playground
package main
import (
"fmt"
)
func main() {
board := [2][3]string{
{"O", "_", "O"},
{"X", "O", "_"},
}
printBoard(board[:][:])
}
func printBoard(board [][]string){
for _, line := range board {
for _, cell := range line {
fmt.Printf("%s", cell)
}
fmt.Println()
}
}
It says cannot use board[:][:] (type [][3]string) as type [][]string in argument to printBoard
I did not manage to correct it printBoard(board[:][:]).
I tried by removing one/both semicolons inside the call, but did not work either. I do not want to specify any length if possible