Repeating Method Invocation Using Recursive Algorithm

In the last chapter, you learned about immutable states that make us not deal with the side effect. In this chapter, let's take a look at the concept of recursion. As a programmer in object-oriented programming, we usually use iteration to repeat the process instead of recursion. However, recursion gives more benefit than iteration. For instance, some problems (mathematics, especially) are solved easily using recursion, and, fortunately, all algorithms can be defined recursively. That makes it much, much easier to visualize and prove. To get to know more about the recursion, the following topics will be discussed in this chapter:

  • Differentiating the iteration and recursion invocation ...

Get Learning C++ Functional Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.