Tech moves fast! Stay ahead of the curve with Techopedia!
Join nearly 200,000 subscribers who receive actionable tech insights from Techopedia.
A recursive function is a function in code that refers to itself for execution. Recursive functions can be simple or elaborate. They allow for more efficient code writing, for instance, in the listing or compiling of sets of numbers, strings or other variables through a single reiterated process.
Recursive functions in code often rely on loop setups, where the initial variable is called on multiple times while being altered by the loop. Simple examples of a recursive function include the factorial, where an integer is multiplied by itself while being incrementally lowered. Many other self-referencing functions in a loop could be called recursive functions, for example, where n = n + 1 given an operating range.
In addition to simpler recursive functions, programmers and others have come up with much more elaborate functions that also work through principles of recursion. Some, like the Fibonacci sequence, have applications to finance and other areas, where others remain esoteric and largely exclusive to the IT community.