Chapter 5 Further Reading: Making Decisions
Pascal Language References
-
Free Pascal Reference Guide, Chapter 12: Statements — Conditional Statements. https://www.freepascal.org/docs-html/ref/refch12.html The official Free Pascal documentation on
if..then..elseandcase..of, including compiler-specific details about theelse/otherwiseclause and ordinal type requirements. -
Free Pascal Programmer's Guide — Compiler Directives: $B (Boolean Evaluation). https://www.freepascal.org/docs-html/prog/progsu4.html Details on
{$B-}` (short-circuit) and `{$B+}(complete) Boolean evaluation modes, including compatibility notes for Turbo Pascal and Delphi.
Textbooks and References
-
Niklaus Wirth, Algorithms + Data Structures = Programs (1976), Chapter 2: Sorting. While the focus is on sorting, Wirth's discussion of conditional logic and structured programming provides the philosophical foundation for Pascal's decision constructs. The title of the book is, of course, our Theme 5.
-
Brian W. Kernighan and P. J. Plauger, The Elements of Programming Style, 2nd ed. (1978). Chapter 3 discusses conditional logic and the importance of readable branching. Many of the "rules" (avoid deep nesting, test boundary conditions, use meaningful variable names) are demonstrated with examples that translate directly to Pascal.
-
Steve McConnell, Code Complete, 2nd ed. (2004), Chapter 15: Using Conditionals. A thorough treatment of
ifandcasestatement best practices, common errors, and decision tables. Language-agnostic advice that applies directly to the patterns in this chapter.
Boolean Logic and De Morgan's Laws
-
Augustus De Morgan, Formal Logic (1847). The original source of De Morgan's Laws. Historically interesting but not recommended as a learning resource — modern discrete math textbooks present the material far more accessibly.
-
Kenneth H. Rosen, Discrete Mathematics and Its Applications, 8th ed. (2018), Chapter 1: The Foundations — Logic and Proofs. An excellent introduction to propositional logic, truth tables, logical equivalences, and De Morgan's Laws. This is the standard reference if you want to deepen your understanding of Boolean algebra beyond what this chapter covers.
Structured Programming
-
Edsger W. Dijkstra, "Go To Statement Considered Harmful," Communications of the ACM, Vol. 11, No. 3 (March 1968), pp. 147–148. The famous letter that launched the structured programming revolution. Dijkstra argued that uncontrolled use of
gotomakes programs impossible to reason about — and thatif..then..else,case, and loops are sufficient for all computation. Pascal was designed to embody this philosophy. -
Ole-Johan Dahl, Edsger W. Dijkstra, and C. A. R. Hoare, Structured Programming (1972). The foundational text that laid the theoretical groundwork for Pascal's control structures. Dahl, Dijkstra, and Hoare argue that programs should be composed from a small set of well-understood constructs — the very constructs you are learning in Chapters 5 and 6.
Decision Tables
- Charles V. Jones, "Decision Tables," in Encyclopedia of Computer Science and Technology, Vol. 8 (1977).
A comprehensive treatment of decision tables as a software specification and design tool. Decision tables can replace complex nested
ifstatements by separating the conditions from the actions in a tabular format.
Online Resources
-
Lazarus/Free Pascal Wiki — Boolean Expressions. https://wiki.freepascal.org/Boolean Covers the Boolean type, comparison operators, and the nuances of Boolean evaluation modes in Free Pascal.
-
Pascal Programming Tutorial — Control Structures. https://www.tutorialspoint.com/pascal/pascal_decision_making.htm A concise online tutorial covering
if..then,if..then..else,case..of, and nested conditionals with examples.
Looking Ahead
-
Chapter 6 introduces the final control structure family: loops (
for,while,repeat..until). Combined with the decisions from this chapter, loops give you Turing-complete computation — the ability to express any algorithm. -
Chapter 7 introduces procedures and functions, which let you extract repeated decision logic into reusable, named units. The repetitive tax bracket code and character attribute code from this chapter's case studies will become dramatically cleaner.
-
Chapter 12 introduces enumerations and sets, which replace the string-comparison category validation in PennyWise with type-safe, compiler-checked alternatives. The
casestatement becomes even more powerful with custom enumeration types.