This animation visualizes fact(5) as it pushes five stacked frames, one for each recursive call, until reaching the base case fact(0). It then shows the stack unwinding in reverse, with each frame computing and returning a value: 1, 1, 2, 6, 24, and finally 120. The visual makes clear why deep recursion consumes memory proportional to call depth, helping students connect abstract recursive code to concrete stack behavior and return-value propagation.
16:9 · Preview before teaching · automatic layout checks do not establish subject accuracy
fact(5) pushes five frames onto the call stack until the base case, then unwinds computing 1, 2, 6, 24, 120 as each frame returns; deep recursion means many frames of memory.