Recursion (just because)
The idea of recursion is to repeat a process multiple times to achieve a goal. The base of recursion is to ask if something happens and then if the result is not fulfilled, repeat the process on a modification of the original given material or a different set until a result is returned. This is wrapped up into a single function which you can call and then it calls itself until a final return statement is given.
For example, one could have a function that subtracts 1 from i and returns the string 'yes' if i - 1 <= 0 and if i != 0, return the function on i - 1.
I have run out of things to say on recursion.
No comments:
Post a Comment