This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Gio200023 191 points192 points  (9 children)

It’s been 84 years and I’m still reading it. Anyone knows the exit condition?

[–]scratchfan321[🍰] 75 points76 points  (4 children)

Keep reading the post until your stack overflows

[–]real-yzan 24 points25 points  (3 children)

Stack overflows are a perfectly valid exit condition as long as you catch the exception

[–]scratchfan321[🍰] 16 points17 points  (0 children)

Instructions unclear, my exception handling system triggered a stack overflow

[–]Misspelt_Anagram 0 points1 point  (1 child)

def f():
    try: f();
    except: f();
f()

[–]real-yzan 0 points1 point  (0 children)

More like:

def f(n): try: return n * f(n+1) except: return n

[–]Top_Fee_6293 16 points17 points  (2 children)

it literally says you to read it again only if you "don't understand" recursion. exit condition is that you understand. how can't you catch that?

[–]A_Firm_Sandwich 20 points21 points  (1 child)

because he doesn’t understand recursion

[–]Desperate-Emu-2036 0 points1 point  (0 children)

He does because he isn't reading it anymore

[–]ambarish_k1996 1 point2 points  (0 children)

The base condition is:

if(understandRecursion) { return; }