A computer is a machine that follows a list of instructions called a program. An Android device is a computer and an app is a program. An app is divided into sections called methods. Each method is a comparatively short list of instructions.

By default, a device executes a method’s instructions in a straight line from top to bottom, in the order in which the instructions are written. Some instructions, however, can choose to direct the device to skip over other instructions, or to repeat other instructions. These instructions that cause the device to deviate from a straight-line path are called the control structure of the method. The resulting path, or set of possible paths, is called the control flow of the method.

It would be a waste of storage if an app included a group of instructions that were skipped every time the app was executed. Conversely, it would be a waste of time to repeat a group of instructions unnecessarily. The control structure can make the correct choices by examining the current content of the app’s variables, which are containers that contain values such as numbers or pieces of text. For example, the control structure can tell the device to skip the execution of method’s “purchase” section if the value zero is stored in the variable that holds the user’s desired number of items to buy.