Recursion, in mathematics and computer science, is a method of defining functions in which the function being defined is applied within its own definition. (Wikipedia) In other words, a recursive function calls itself to do its job. Recursion is a widely used approach to solve many programming tasks.
Function Factorial(ByVal n As UShort) As UShort If (n=0) Return 1 Else Return n * Factorial(n-1) End If End Function