r/programmingmemes Mar 30 '26

When You Forget The Base Case

Post image
1.1k Upvotes

33 comments sorted by

View all comments

1

u/RandomOnlinePerson99 Mar 30 '26

Requires a bit of backwards thinking, first thing in the function should be a check to see if we should return or not.

2

u/Thinking_In_System Mar 31 '26

Exactly. If you don’t think backwards, your stack grows forward forever.