“*Recursion (computer science), a procedure or subroutine, implemented in a programming language, whose implementation references itself*” Wikipedia. In this case, Recursive Function is a function that call or reference it self to do some repetitive actions. Different with iteration function that use loop, recursion function dont use loop to do repetitive function. Therefore, Recursive Function may be called several times while the iteration function only called once.

This is simle example of recursive factorial function (example using javascript).

function Factorial_Recursive(n){
if (n <= 1) return 1;
else
return n * Factorial_Recursive(n - 1);//this call itself
}

In this case, Factorial_Recursive(n) function will call itself and be executed several times if you declare the ‘n’ variable at least 2.

Other more simple example function using php.

function Simple_Recursive($n){
if($n!=0){
echo $n.' ';
$n--;
Simple_Recursive($n);
}
}
Simple_Recursive(10);

The above function will give output “10 9 8 7 6 5 4 3 2 1”.

To put it simple, recursive funcition is a function that call it sefl to do repetitive action.

http://septiadi.com/2011/06/13/recursive-function/

### Like this:

Like Loading...

*Related*

June 13th, 2011 at 10:44 am

design nya GG kakz..

;))

June 13th, 2011 at 10:46 am

itu template bung

gratisan

wkwkwkwkwkwk