Comment on Why does the for loop repeat in this recursion?
milon@lemm.ee 10 months agoThanks. I did see that. I have a general understanding of how recursion works I think where the function calls itself again and again but I don’t get why the code (for loop) below the draw(n - 1) is recursive.
xmunk@sh.itjust.works 10 months ago
The code below the
draw(n - 1)
isn’t recursive… the call todraw(n - 1)
is the recursion.Sometimes, it can be helpful to invert recursion. Think about what draw(0) would be and write it down… then compute draw(1) using the value you previously computed for draw(0).