10FLOW CONTROL
So far, we’ve been focusing on the components of programs, such as expressions, variables, and data types. We’ve strung a few of these together into simple executable instructions, but these have been mostly linear in nature; in other words, they were executed in the order in which they were written. More complex programs will include branching instructions that skip whole sections of code, jump back to the beginning, or decide among multiple options. To handle these situations, you’ll need a way to control the flow of your code.
The flow of execution refers to the order in which statements are run in a program. Execution starts ...
Get Python Tools for Scientists 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.