In Scala (and most other functional languages) the result of a function is the value of the last expression in the block. The last expression of your balance
function is the definition of function getCount
, which is of type Unit
(the Scala equivalent of void
), and your function is declared as returning a Boolean
, thus the error.
In practice, you've just screwed up your brackets, which would be obvious if you used proper indentation (Ctrl+A, Ctrl+Shift+F in scala-ide).