In this lesson, we will introduce Flow Controls in C++, their types, usage, and examples to better understand the topic.
“Control statements are statements used in programming languages to handle the program’s execution.”
In C++, statements are typically executed in the order that they occur, sequentially from top to bottom. Your program statements might not always be performed sequentially, one after the other. You may need to execute or skip a specific set of instructions based on a condition, jump to another set of statements, or repeatedly execute a group of statements.
According to the application logic, control flow statements in C++ are used to change, reroute, or control program execution flow.
We will learn about the control flow types in this lesson and how to use them with examples.
There are cases where we want a block of code to run only when a specific condition is met. With various decision-making statements in C++, a computer can choose which block of code to run based on many conditional options. Selection statements are another name for decision-making statements. A decision-making statement assesses one or more condition expressions to determine if the result is TRUE or FALSE.
The condition result helps determine which block of statements should be executed if the condition is TRUE or FALSE respectively.
This concludes the C++ Flow Control lesson. In the next lesson, you will learn about if Statements in C++.