title: Go language: Type XXX is not an expression
body: <p>I have written a function:</p>
  
  <pre><code>func Pic(dx, dy int) [][]uint8 {
      type matrix [][]uint8 
  
      for i := 0; i &lt; dx; i++ { // fills up the matrix with z's in their right places.
          for j := 0; j &lt; dy; j++ {
              matrix[i][j] = Z(i,j)
          }
      }
  
      return matrix
  }
  </code></pre>
  
  <p>that is supposed to fill up a matrix with z values for each x and y value and return it. As I want to have different dimensions for the matrix depending of parameters to the Pic function, I create a slice i line 2. Then in my for loops i fill the matrix up.</p>
  
  <p>I get an error upon running this code: <code>type matrix is not an expression</code> for the <code>matrix[i][j] = Z(i,j)</code> line. What am I doing wrong? Should matrix[i][j] evaluate to an expression? Why should it, when I want to put something there (it's empty/non-existent now!) ?</p>