forum

Home / DeveloperSection / Forums / How to understand the recursive call to itself

How to understand the recursive call to itself

Kenny Tangnde 2263 03-Nov-2011

Hi all,

   such as:

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

Its principle is to perform what,why the output is 24.

thanks!


c# c# 
Updated on 03-Nov-2011

Can you answer this question?


Answer

2 Answers

Liked By