What Is a Recursion?
In a programming language, if the function Func (Type a, ...) directly or indirectly calls the function itself, the function is called a recursive function. Recursive functions cannot be defined as inline functions.
- A calculation process in which the results of the previous step or steps are used for each step, which is called recursive. Functions defined by recursive processes are called recursive functions, such as continuous addition, continuous multiplication, and factorial. Every recursive function is computable, that is, it can work [1]
- in
- The concept of a function is a very general concept. When defining a function, it is not necessary to give a specific method for obtaining the value of the function from the independent variables. Therefore, functions can be divided into two types, one is a so-called computable function, and the other is a non-computable function. This former function is very important in theory or in fact, so people try to give them a precise mathematical description. A recursive function is one of many such descriptions [2]
- [Pascal language]
// Use VB code format, actually Pascal functiondo (x: integer); begin ifx <= 1thenexit (0) elseifx> 1thenexit (do (x-1) +10) end;