Many tasks in computer programs need to be repeated. Normally, the code used for this is iterative, instructing the computer to perform a series of operations multiple times until certain conditions are met. Recursive programming uses a slightly different strategy to repeat tasks. Rather than simply repeating steps multiple times, recursive code calls itself. Typically, one will code recursion in the form of a subroutine that will continue calling itself until certain conditions are met. One of the most important concerns in recursive programming is preventing excessive recursion as it will cause various system stacks to overflow, something not an issue in more traditional iterative programming where infinite loops can be a problem, but one does not have issues concerning the way an operating system stores return addresses from subroutines.
Because of the issues of stack overflows, when a problem can be solved iteratively, that is usually preferable. There are certain types of problems where recursion can be more efficient. In systems with limited amounts of memory, such as embedded systems, the compact nature of recursive code can save valuable space and loading time, although it will increase the size of call stacks. Also, for problems with many possible branches and options, it can be more efficient than iterative programming.