Created
July 26, 2017 09:34
-
-
Save kt-aakash/446a1f7f1a5e35a3cfc2f3ed40b6b5d3 to your computer and use it in GitHub Desktop.
A virtual illustration of a recursive function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function factorialize(3) { | |
if(3>1) | |
return 3*factorialize(2){ //**********This staten=ment gets executed SINCE 3 > 1 is true | |
if(2>1) | |
return 2*factorialize(1){ //**********This staten=ment gets executed SINCE 2 > 1 is true | |
if(1>1) | |
return 1*factorialize(0); | |
else | |
return 1; //**********This staten=ment gets executed SINCE 1 is not greater than 1 | |
}; | |
else | |
return 1; | |
}; | |
else | |
return 1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment