recursion algorithm in math code example
Example 1: recursion
/*Java*/
static void recursion(){ recursion(0); }
static void recursion(int x){
System.out.println("eheh " + x);
if(x != 666) recursion(x+1);
}
Example 2: recursion
function loop(x) {
if (x >= 10) // "x >= 10" is the exit condition (equivalent to "!(x < 10)")
return;
// do stuff
loop(x + 1); // the recursive call
}
loop(0);