title: Why does Scala's semicolon inference fail here?
body: <p>On compiling the following code with Scala 2.7.3,</p>
  
  <pre><code>package spoj
  
  object Prime1 {
    def main(args: Array[String]) {
      def isPrime(n: Int) = (n != 1) &amp;&amp; (2 to n/2 forall (n % _ != 0))
      val read = new java.util.Scanner(System.in)
      var nTests = read nextInt // [*]
      while(nTests &gt; 0) {
        val (start, end) = (read nextInt, read nextInt)
        start to end filter(isPrime(_)) foreach println
        println
        nTests -= 1
      }
    }
  }
  </code></pre>
  
  <p>I get the following compile time error :</p>
  
  <pre><code>PRIME1.scala:8: error: illegal start of simple expression
      while(nTests &gt; 0) {
      ^
  PRIME1.scala:14: error: block must end in result expression, not in definition
    }
    ^
  two errors found
  </code></pre>
  
  <p>When I add a semicolon at the end of the line commented as <code>[*]</code>, the program compiles fine. Can anyone please explain why does Scala's semicolon inference fail to work on that particular line?</p>