Chapter 4 Flow-Control

Foxtrot, October 3, 2003.  Used with permission.

Figure 4.1: Foxtrot, October 3, 2003. Used with permission.

In the above scene from the comic-strip Foxtrot, young Jason has attempted to short-cut his “write-on-the-blackboard” punishment via some code in the C-language that would print out his assigned sentence 500 times. This is an example of flow control.

Flow control encompasses the tools in a programming language that allow the computer to make decisions and to repeat tasks. In this Chapter we will learn how flow control is implemented in R.