Chapter 7

Arrays and Lists in Scala

Adding conditionals and logic expanded our capabilities dramatically. Combining it with recursion gives us the ability to do almost anything we want. Technically, we have full computing power. However, there are some ideas that are challenging to express with what we currently know and there are better ways to say them in Scala and programming languages in general.

One of these ideas is the ability to refer to many different objects. In chapter 3 we gained the ability to refer to objects by names with val and var declarations. Using those, we could make as many names as we want and hard code in references to them. We could even have big match statements that allow us to select particular variables based on ...

Get Introduction to the Art of Programming Using Scala 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.