How to write Recursive Procedures?
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
Log in to answer.
Abhay 12:22 am on December 16, 2009
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