r/ProgrammerHumor • • 14d ago

Meme recursion

Post image
959 Upvotes

41 comments sorted by

View all comments

Show parent comment

19

u/Level-Pollution4993 14d ago

Each brick is a function call, one function call invocates another function which then leads to the other and so on until the last brick; which is the base case. When the base case is reached, suddenly all functions start returning their values unwinding the call stack until the initial call completes, returning the final value; represented by the final ordered bricks.

7

u/Wonderful-Habit-139 14d ago

I stand corrected. Amazing. Take my updoots.

16

u/_Ganon 14d ago

I dont think a recursion demonstration better than this exists.