Dart - Control Flow Statements
The control flow statements are used to define the control on the flow of the program. Dart programs are executed in sequential order i.e., the order in which the programming statements are written. We use control flow statements in the program when we want to set the flow of the program on the basis of some decision like skipping some statements on the given condition, jumps to another statement or iterate the statements.
Types of flow statements:
- Decision-making statements
- Looping statements
- Jump Statements
Decision-Making Statements in Dart
The decision-making statements enable the execution of the program instructions on the basis of test expression evaluation at the runtime. These test expressions evaluate to Boolean True and False, and helps in deciding the flow of the program. In the program, we have certain instructions corresponding to both True and False and depending on the evaluation result either of these statements are followed.
These statements are also called as selection statements.
Following are the decision-making statements :
- If Statements
- If-else Statements
- If-else-if Statements
- Switch Case Statements
Looping Statements in Dart
The looping statements are used to iterate over certain block of statements given number of times till the test condition evaluates to true. These statements are also known as iteration statements.
Following are the looping statements :
- For loop
- For….in loop
- While loop
- Do-while loop
Jump Statements in Dart
The jump statements are used to transfer the control of current statements to another statements.
Following are the jump statements :
- Break statement
- Continue statement