ABSTRACT

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 every line in a script executes 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 choices are made and some things happen 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 some problems.