Chapter 5

Logicals and Control Structures in ProgrammingConditional Statements, Loops, and Functions

5.1 Introduction: Controlling the Flow of Execution

When a computer program is run, the commands are executed in a particular order. As discussed in Chapter 4, the order is usually top to bottom, left to right for the commands in a script. This does not always need to be the case, as a programmer can instruct the computer to follow a different order.

Many programming languages, including MATLAB, include designated keywords to change the order of executed commands. These parts of a programming language are called control structures. Additional documentation related to this chapter can be found on the MathWorks website under Control Flow.

For the ...

Get Hack Audio 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.