Posts

Showing posts from September, 2009

Writing Recursive Functions

How to Write Recursive Functions A recursive procedure is one that calls itself. Example is as follows – The following procedure uses recursion to calculate the factorial of its original argument. Function factorial(ByVal n As Integer) As Integer
If n <= 1 Then
Return 1
Else
Return factorial(n – 1) * n
End If
End Function