Chapter 7. If Only, Unconditionally, Forever

If Only, Unconditionally, Forever

Control Structures, Blocks, and Compound Statements

People plan their lives by making decisions, and so do programs. Figure 7.1 is a flow chart. A flow chart is defined as a pictorial representaion of how to plan the stages of a program. It helps you to visualize what decisions need to be made to accomplish a task. According to computer science books, a good language allows you to control the flow of your program in three ways:

  • Execute a sequence of statements.

  • Based on the results of a test, branch to an alternative sequence of statements.

  • Repeat a sequence of statements until some condition is met.

Figure 7.1. A ...

Get Perl by Example, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.