Crack recursion: 12 levels of base cases, recursive cases and stack traces. The most in-depth recursion game around. 20 levels, right in the browser.
Recursion is a function that calls itself. Every recursive function needs a base case: a condition that stops without calling again. Without one, the calls never run out.
A recursive function can return a value. Each call waits for the next call's answer, then uses it to work out its own.
The factorial of n is n × (n - 1) × … × 1. Recursively: factorial(n) = n × factorial(n - 1), with the base case factorial(1) = 1.
Fibonacci calls itself twice at every step (it branches). Its number of calls grows much faster than n.
A tail call: the recursive call is the last thing its function does. An accumulator carries the running result in a parameter, so the answer is ready when the base case is reached.
Mutual recursion: two or more functions call each other. It fits things that depend on each other (even and odd, a parser that calls another parser).