title: Scala - block can not contain declarations
body: <p>I have the following method where I am searching for the position of a character in a 2D vector.</p>
  
  <pre><code>  def findChar(c: Char, levelVector: Vector[Vector[Char]]): Pos = {
      var pos: Pos
      pos.x = levelVector.indexWhere(row =&gt; row.indexOf(c) &gt; 0)
      pos.y = levelVector(pos.x).indexOf(c)
      pos
    }
  </code></pre>
  
  <p><code>pos</code> has two integer fields which remember positions on the x and y axis</p>
  
  <p>However, on the line <code>var pos: Pos</code> I am getting the error <code>Block cannot contain declarations</code>. </p>
  
  <p>Why can't the block contain declarations?
  Which is the issue with my code?</p>