What do you understand by flow of control? Explain its different types.
Answer:
The flow of control depicts the flow of events as represented in the flow chart. The events can flow in a sequence, or on branch based on a decision or even repeat some part for a finite number of times.
Three types of flow of control are:
- Sequence - It has events occurring in a sequence one after the other without being dependent on any condition.
- Selection - Here the flow of control gets branched based on whether a particular condition evaluates to true or false.
- Repetition - Here a sequence of steps is performed iteratively until some condition is met.