Jumping Control Statements
Jumping
Jump statements are used to interupt the flow of program or exit from the particular sections of the progam.They are of 3 types which are mentioned below:-
- goto statement
- continue statement
- break statement
goto statement It is used to provide unconditional jump from one statement to another statement.
Syntax:-
goto;
continue statement This loop is used to continue loop. It will skip a specific instruction or condition which is given by us.
Syntax:-
continue;
Example:-
for(int i=0;i<=5;i++){
if(i==2){
continue;
}
cout<<i<<endl;
}
Output:-
0
1
3
4
5
break statement This statement is used to break the line of a program as we saw in switch statement.
Syntax:-
break;
Comments
Post a Comment