Chapter 5. Hello Recursion!

Some readers accustomed to imperative and object-oriented programming languages might be wondering why we haven’t covered loops already. The answer to this is a question: What is a loop? The truth is that functional programming languages usually do not offer looping constructs like for and while. Instead, functional programmers rely on a silly concept called recursion, which is the topic of this chapter.

image with no caption

How Recursion Works

Recall how invariable variables were explained in Chapter 1 (if you can’t, reread Invariable Variables in Invariable Variables). Recursion can also be explained with the help of mathematical concepts ...

Get Learn You Some Erlang for Great Good! 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.