I'm having type mismatch in the end line of 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
balanceexpectsBooleanas a return value, but you only definedfand did nothing else inbalance- Victor Moroz