Introduction to Diving into Recursion

Get an overview of what will be covered in this chapter and an introduction to recursion.

A simple script that counts to 10, a homepage that shows recent news, a program that parses each line of a CSV file, what do these programs have in common? They all need to do repetitive tasks to determine the final result. Recursive functions are the core of repetition in functional programming.

In imperative languages, iterative features like for and while loops are responsible for repetition behavior. Both for and while loops rely on the mutable state. In functional programming, we have an immutable state, so we need a different approach. Here we use recursive functions.

Get hands-on with 1200+ tech skills courses.