Recursive Functions
Recursive Functions is supported.
You can write a function that is recursive (a function that calls itself). Here is an example that computes the factorial of an integer:
Be careful that you do not write a function that is infinitely recursive. In the above example, once x is 1, the recursion stops. However, in the following example, the recursion does not stop until the program is interrupted or runs out of memory:
Functions can also be indirectly recursive, of course.
Last updated
Was this helpful?