title: Why do I have "Type mismatch; Found Unit, expected Boolean" in Scala-IDE?
body: <p>I've got the following Scala code(ported from a Java one):</p>
  
  <pre><code>import scala.util.control.Breaks._
  
  object Main {
  
  def pascal(col: Int, row: Int): Int = {
      if(col &gt; row) throw new Exception("Coloumn out of bound");
      else if (col == 0 || col == row) 1;
      else pascal(col - 1, row - 1) + pascal(col, row - 1);
  }
  def balance(chars: List[Char]): Boolean = {
    val string: String = chars.toString()
    if (string.length() == 0) true;
    else if(stringContains(")", string) == false &amp;&amp; stringContains("(", string) == false) true;
    else if(stringContains(")", string) ^ stringContains("(", string)) false;
    else if(getFirstPosition("(", string) &gt; getFirstPosition(")", string)) false;
    else if(getLastPosition("(", string) &gt; getLastPosition(")", string)) false;
    else if(getCount("(", string) != getCount(")", string)) false;
    var positionOfFirstOpeningBracket = getFirstPosition("(", string);
    var openingBracketOccurences = 1; //we already know that at the first position there is an opening bracket so we are incrementing it right away with 1 and skipping the firstPosition variable in the loop
    var closingBracketOccurrences = 0;
    var positionOfClosingBracket = 0;
    breakable {
      for(i &lt;- positionOfFirstOpeningBracket + 1 until string.length()) {
  
          if (string.charAt(i) == ("(".toCharArray())(0)) {
              openingBracketOccurences += 1;
          }
          else if(string.charAt(i) == (")".toCharArray())(0) ) {
              closingBracketOccurrences += 1;
          }
          if(openingBracketOccurences - closingBracketOccurrences == 0) { //this is an important part of the algorithm. if the string is balanced and at the current iteration opening=closing that means we know the bounds of our current brackets.
              positionOfClosingBracket = i; // this is the position of the closing bracket
              break;
          }  
  
      }
    }
    val insideBrackets: String = string.substring(positionOfFirstOpeningBracket + 1, positionOfClosingBracket)
    balance(insideBrackets.toList) &amp;&amp; balance( string.substring(positionOfClosingBracket + 1, string.length()).toList)
  
    def getFirstPosition(character: String, pool: String): Int = 
      {
          for(i &lt;- 0 until pool.length()) {
              if (pool.charAt(i) == (character.toCharArray())(0)) {
                  i;
              }
          }
          -1;
      }
  
  def getLastPosition(character: String, pool: String): Int =
  {
      for(i &lt;- pool.length() - 1 to 0 by -1) {
          if (pool.charAt(i) == (character.toCharArray())(0)) {
              i;
          }
      }
      -1;
  }
  
  //checks if a string contains a specific character
  def stringContains(needle: String, pool: String): Boolean =  {
      for(i &lt;- 0 until pool.length()) {
          if(pool.charAt(i) == (needle.toCharArray())(0)) true;
      }
      false;
  }
  
  //gets the count of occurrences of a character in a string
  def getCount(character: String, pool: String) = {
      var count = 0;
      for ( i &lt;- 0 until pool.length()) {
          if(pool.charAt(i) == (character.toCharArray())(0)) count += 1;
      }
      count;
  }
  }
  }
  </code></pre>
  
  <p>The problem is that the Scala IDE(lates version for Scaal 2.10.1) gives the following error at line 78(on which there is a closin brace): "Type mismatch; Found Unit, expected Boolean". I really can't understand what the actual problem is. The warning doesn't give any information where the error might be.</p>