Previous | Next | Table of Contents | Index | Program List | Copyright

CHAPTER 4

Decision Statements; Writing Simple Functions and Packages


4.1 Control Structures: Boolean Expressions and the IF Statement
4.2 Problem Solving: Decision Steps in Algorithms
4.3 Tricks of the Trade: Tracing a Program or Algorithm
4.4 Problem Solving: More Strategies
4.5 Control Structures: The Multiple-Alternative IF Statement
4.6 System Structures: Using Ada's Math Library
4.7 System Structures: Writing Simple Functions
4.8 System Structures: Writing a Simple Package
4.9 Tricks of the Trade: Common Programming Errors
Chapter Review

In this chapter we show you how to represent decisions in algorithms by writing steps with two or more alternative courses of action. You will see how to implement conditional execution in Ada by using Boolean conditions and the Ada IF statement. This chapter provides many examples of program fragments containing IF statements.

This chapter also introduces you to the process of writing simple reusable functions and putting them in packages for later use by yourself and others. This continues the practice begun in Chapters 2 and 3, in which each chapter introduces new material that will help you structure small program units but also shows you immediately how to integrate this new material into larger, system-level units. In this way you will always focus your attention on the two equally important problems of building individual programs and building libraries of programs into systems.


Previous | Next | Table of Contents | Index | Program List | Copyright

Copyright © 1996 by Addison-Wesley Publishing Company, Inc.