Flow of Control
Control Structures defines as
" The statement which controls flow of execution of the program are the control structures. "
0r
" It controls the flow of execution. "
There are three types of Control Statement
1- Sequence / Linear -
In this type of execution,there is no control statements. All statement in a the program are executed on after one or one by one.
2- Alternative / Branching / Selection / Jumping -
In this type of execution,Some parts of the program will be execute depending upon the conditions.
Eg-
- if statement ,
- if-else statement ,
- if ladder
- switch
3- Iterative / Looping -
There are the statement which execute some statement repeatedly. The statement which are execute repeatedly is known as body of the loop.
Eg-
- for loop
-while loop
-do while loop
Now , There are two types of loop...
a) Entry Controlled loop -
Before entry to the loop condition is checked if it is true controls enter in the loop otherwise not.
Eg- for loop and while loop.
b) Exit Control loop -
In Exit Control loop, One time loop executed then Check the Condition, If condition is true then iterative once again otherwise not.
Eg- do While.
Now Two Important terms Which we always use in looping -
# Break Statement - This statement is used to transfer the control out side from the current loop or switch statement.
# Continue Statement - This is statement to skip statement but it tranfer the control to staring point to the loop.It cause next iteration.
By - Somesh Sah
Comments
Post a Comment