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 4

Conditionals

We solved some basic problems in the last chapter, but the techniques that we have access to are fundamentally limited at this point. The real problem is that all the lines in a script execute in the same order from top to bottom every time the script is run. In most real problems we need to be able to do what is called conditional execution, where something happens only in certain situations. In this chapter we will learn the most fundamental method for doing conditional execution in Scala and see how we can use it to solve more complex problems.

In order to do this properly, we need to develop a formalized way to express logic and put it into our programs. This system, called Boolean logic, will allow us to state the ...

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