- A method or function that calls itself.
- A type of iteration or looping.
- Must have a stopping condition.(To prevent endless loops)
Two types:
- Tail: when the last thing that happens is the recursive call.
- Head: when it happens first.
Some situations in programming can only be solved with recursion. (e.g.: displaying a list of files within a directory structure)
Factorial
multiplication of every value between zero and itself.
No comments:
Post a Comment