Recursion

From GCHSWiki
Jump to: navigation, search

Recursion is a programming technique in which a method calls itself. In a sense, a recursive method calls itself and repeats portions of it's code until a termination command (base case) is executed. When writing a recursive method, two things must be kept in mind:

1. The recursive call must be ran at least once.
2. There must be a way to end the recursive "loop" by introducing a base case.