When the draw function calls itself it yields control to that new function its calling. When that function ends it takes back control and continues doing what it was doing.
This means all of the for loops in all of the functions will execute. Draw(1) will do the for loop and then return as it hits the end of the function (standard behaviour when you reach the end of a function even if theres no return statement). Then draw(2) will do the for loop and then return, etc. all the way up
All parts of a function are recursive, theres no such thing as a non recursive part
jrbaconcheese@yall.theatl.social 10 months ago
No, the moment that draw(9) is called, draw(10) goes on pause while draw(9) finishes… which repeats (or recurses) until draw(0) gets called. Then it _return_s which returns to draw(1). The draw(1) un-pauses and does the #\n bit and returns to draw(2), which un-pauses and does ##\n and so forth until draw(10) does ##########\n
milon@lemm.ee 10 months ago
Gotcha. Thanks for the explanation.