Scala function returns Unit but should return Int

I just started learning Scala last week. I created a stub method in one of my programs but was getting an error. Here’s my function: def howMuch(max: Int) { var n = 0 n } I tried to use the result in expression, e.g. var m = 1 var n = howMuch(100) m += n … Continue reading Scala function returns Unit but should return Int