Recursive Functions
Moderator: General Moderators
-
everydayrun
- Forum Commoner
- Posts: 51
- Joined: Wed Jan 20, 2010 1:30 am
Recursive Functions
i don't know it very well,only know it return itself.now,i want to know how to use it. and do a deeply understand on it. any tips would be appreciated.
-
everydayrun
- Forum Commoner
- Posts: 51
- Joined: Wed Jan 20, 2010 1:30 am
Re: Recursive Functions
anyone helps?
Re: Recursive Functions
Take a look at the recursive definitions of Fibonacci series or factorials for examples:
http://en.wikipedia.org/wiki/Fibonacci_number
http://en.wikipedia.org/wiki/Factorial
In general you need a structure like this:
http://en.wikipedia.org/wiki/Fibonacci_number
http://en.wikipedia.org/wiki/Factorial
In general you need a structure like this:
Code: Select all
function recursive(args, ...)
{
if (condition_to_stop_rescursion_is_true)
return (result_to_return_on_recursion_stop);
else
return recursive(args_to_be_passed_on_recursive_call);
}There are 10 types of people in this world, those who understand binary and those who don't