def recursiveSum(xs: List[Int]): Int =
if (xs.isEmpty) 0
else (xs.head + recursiveSum(xs.tail))
recursiveSum(List(1, 2, 3))
// res0: Int = 6
Scala- 30 min
- Blog
- Computer Science
- Scala, VS Code
We could spend our entire developer’s life using just the basic concepts of any programming language we choose to…