Recursive methods is a method in which it calls itself.
Recursive methods have three primary qualities:
- They call themselves at least once
- They have a condition that stops the recursion
- They use the result return by themselves
def sum(n) return 1 if n == 1 # 2. Stopping condition n + sum(n - 1) # 1. Calls itself, 3. Uses the return result end