title: Type Mismatch in Scala
body: <p>I'm having type mismatch in the end line of code</p>
  
  <pre><code> def balance(chars: List[Char]): Boolean = {
  
   def f(chars: List[Char], count: Int) :Boolean= 
    if(chars.isEmpty) {(count==0)}
  
        else if (chars.head == '(') f(chars.tail,count+1)
        else if(chars.head == ')') f(chars.tail,count-1)
        else f(chars.tail,count) 
  
   }  //Type mismatch; found: unit required Boolean
  </code></pre>