I am a beginner in Scala and in programming as such. Trying to shift to Data Science and am learning stuff on my own. I apologize if this is a very trivial question. Can someone please tell me what is wrong with the main function here? I am trying to pass arguments in the countChange function but the code doesn't print anything. I have tried to look it up and understand, but I am totally lost and any help would be much appreciated! Thank you!
object main {
def countChange(money: Int, change: List[Int]): Int = {
def totalWays(sum: Int, denomination: List[Int]): Int = {
if (sum < 0) 0
else
if (sum == 0) 1
else
if (denomination.isEmpty && sum >= 0) 0
else
countChange(sum, denomination.tail) + countChange(sum-denomination.head,denomination)
}
countChange(money, change.sortWith(_.compareTo(_) < 0))
}
def main(args: Array[String]) {
val l = List(1,2)
println(countChange(0,l))
}
}