Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Help with recursion

Name: Anonymous 2011-05-09 20:43

So, can anyone tell me why does this http://pastie.org/1883229 recursive function just "jump out" of recursion when it returns d * 2 at depth == 1? It doesn't iterate all the way back down as it should, it just returns d * 2 to main function.

Name: Anonymous 2011-05-09 20:55

You do nothing when depth > 1.  It is going through all the stages, instead do return calc(d, depth - 1) * 2; or something.

I HELPED HIM!

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List