title: In Scala, are semicolons necessary in some situations?
body: <p>I'm studying Scala and trying to use it in my recent projects. And problems come. Here's one of my problem about necessity of semicolons. This is my example:</p>
  
  <pre class="lang-scala prettyprint-override"><code>var str = "123.4"
  var d = str toDouble
  if(d &gt; 10)
      println("Larger than 10")
  </code></pre>
  
  <p>These codes cannot be compiled. Because <code>if(d > 10) println("Larger than 10")</code> returns value and compiler thinks this value is a parameter of <code>toDouble</code> method. However, <code>toDouble</code> doesn't have a parameter. This causes error.</p>
  
  <p>The easiest way to solve this is adding a semicolon at the end of line 2. Just like this:
  </p>
  
  <pre><code>var str = "123.4"
  var d = str toDouble;
  if(d &gt; 10)
      println("Larger than 10")
  </code></pre>
  
  <p>This confused me and I thought I don't need semicolons at all as I won't put two statements at same line. It makes me uncomfortable that some lines end with semicolon while the others don't. Also, does it makes sense?</p>