Assignment to work on Scala Recursion