Skip to main content
Logo image

Chapter 2 Programming

Programming is the process of writing a sequence of commands that a computer can follow to perform a task. A programming language, like MATLAB, provides a way to communicate your instructions to your computer.

πŸ“: β€œTasks”.

When you move from experimenting in the command window to writing scripts and functions, you package commands into tasks and decide how those tasks should run. As a programmer, your job is to steer the flow of your program so it runs the correct commands at the right times.
Scripts execute statements from top to bottom by default, and functions bundle a sequence of tasks you can reuse. However, most programs need to make decisions and repeat actions based on conditions. This section discusses the different flow patterns of code and the ways you can control them.