Conditional Function Definitions
An essential aspect of computer programs is their ability to make decisions — to proceed differently depending upon properties of the data they are operating upon. In this chapter, we explore two different ways of building decision-making into Mathematica programs: multi-clause definitions, in which a function is defined by more than one rule; and conditional functions, which return one of several values depending upon a condition. These features will greatly expand what we can do with Mathematica; they are also a crucial step toward learning the basic techniques of recursion and iteration.
KeywordsFunction Definition Point Quadrant Conditional Expression Empty List Conditional Function
Unable to display preview. Download preview PDF.