Chapter 6. Making Decisions with Branches
The simplest programs consist of one or more instructions or lines of code that the computer follows sequentially, one after another. While such sequential ordering forms the basis for programming, programs need greater flexibility to make decisions depending on the current situation.
A branch provides the computer with a choice of two or more different sets of instructions to follow. The simplest type of branch provides two choices, but there's no theoretical limit to the number of branches a program can have. A complicated program may need to make hundreds or even thousands of possible decisions.
Computers decide which choice, or branch, to follow based entirely on a certain condition, known as a Boolean ...
Get Mac Programming for Absolute Beginners now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.