bet365 interview question

Convert an OO function involving a for loop into a recursive function