A recursive procedure is one that calls itself. : Recursive « Language Basics « VBA / Excel / Access / Word






A recursive procedure is one that calls itself.

 
Public Function Factorial(N As Integer) As Integer
    If N <= 1 Then
        Factorial = 1
    Else
        Factorial = Factorial(N - 1) * N
    End If
End Function
Sub res()
   Debug.Print Factorial(4)
End Sub

 








Related examples in the same category

1.Recursive Procedures
2.Recursive function to calculate the faculty of x