Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Factorial

Implement the factorial function recursively.

n! = 1 * 2 * 3 * ... * n

Recursive definition

0!  = 1
n! = n * (n-1)!