O'Reilly logo

Introduction to the Art of Programming Using Scala by Mark C. Lewis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 28

Recursion

Recursion first appeared in this book in chapter 6 when it was used to provide basic iteration. This was extended upon in chapter 15 where the memory of the stack was utilized with recursive functions that call themselves more than once. This chapter will revisit the concept of recursion to help solidify it in your mind.1 The next three chapters will utilize recursion, making this an ideal time to provide a refresher and integrate it into our project.

28.1 Refresher

A recursive function is nothing more than a function that calls itself. This means that it is defined in terms of itself. This seemingly circular type of definition works because all recursive functions need some form of base case where they do not call themselves. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required