recursion
A method calling itself on a smaller version of the problem.
A recursive method invokes itself; it terminates through a base case, and each active call occupies a frame on the call stack.
Loading interactive…
Examples
static int Factorial(int n) => n <= 1 ? 1 : n * Factorial(n - 1);calls itself on a smallernuntil it reaches 1.
See also