Welcome to the Monastery | |
PerlMonks |
Re: recursion basicsby sundialsvc4 (Abbot) |
on Jun 23, 2015 at 12:57 UTC ( [id://1131620]=note: print w/replies, xml ) | Need Help?? |
A useful way to see recursion in action is to add a variable to the function&rquo;s parameter list which is simply used to show the recursion nesting-level . . .
The outermost call begins first but finishes last. The innermost call, which does not “call itself,” of course finishes immediately. This trivial example does not illustrate that each instance of the recursive function (like any instance of any function-call), has its own distinct set of local variables.
In Section
Seekers of Perl Wisdom
|
|