Let's say you have function fn(int a) {if (something) fn(a);}
so lets then say that on the first call, something is true, it calls fn(a) again, the second time something is false.
after the second fn call, does it return back to the first fn call and evaluate to the end, or is calling a recursive function act like a break in the first fn call?
why would anyone use recursion? i've only seen it implemented one time to initialize gui elements. which could have been done through iteration, seems like recursion is very slow but i've been taught it in multiple coding classes.
People would use recursion when it's the right thing to do given all the constraints and requirements, such as the problem at hand, the facilities available, their own knowledge, ease of coding, the applicability of a recursive solution to the task, and various other factors.
This, of course, is the answer to the general question "Why would anyone use __ ?" , for any possible programming facility or technique.