r/ProgrammerAnimemes • • Mar 23 '20

Comments you can't remove

Post image
861 Upvotes

53 comments sorted by

View all comments

Show parent comment

2

u/StarDDDude Mar 24 '20

Shouldn't that thing break no matter if you uncomment the code, as there is no limit to when it stops calling itself.

3

u/bucket3432 Mar 24 '20

If you uncomment the code, then yes, it won't terminate. But as written it does because it doesn't call anything when n reaches 0.

1

u/StarDDDude Mar 24 '20

Oh yes thanks for clarifying, I overlooked how the else section wouldn't be executed if it reaches 0.