Comparison to Loops

Everything that can be accomplished by using loops can be accomplished using recursion. This means it is always possible to take some code using loops and translate it mechanically to code using recursion.

void seasonFoodRecursive(int times) {
    if (times == 0) {
        return;
    }
    else {
        System.out.println("seasoning");
        seasonFoodRecursive(times - 1);
    }
}

void seasonFoodIterative(int times) {
    for (int i = 0; i < times; i++) {
        System.out.println("seasoning");
    }
}

void main() {
    System.out.println("Recursive");
    seasonFoodRecursive(2);
    System.out.println("Iterative");
    seasonFoodRecursive(2);
}

Not everything that can be accomplished by using recursion can be accomplished using loops. At least without introducing some data structure to track what would otherwise be stored in Java's call stack. The following video goes a little further in depth as to why.

This is part of why its important to power through recursion. There are things that can only be solved with it and there are things that are more easily solved with it.