What is the difference between iteration
and recursion
and why/when is one better:
while (true) {
// Iterating
}
They can be used interchangeable to solve different problems. In essence you can write recursive functions iteratively and vise versa.
Iteration may increase the performance of your program. Whereas recursion may give a more intuitive and elegant result. You can choose either which to your preference!