Transfer Statements

33 views.

Break:

Break is a transfer statement which can be used either inside switch statement or inside a loop.

  • The break statement, when used in switch will transfer the control from inside the switch to outside the switch, so that we skip the execution of removing cases.
  • The break statement, when used in loop, will transfer the control from inside the loop to outside the loop, so that we will skip execution of remaining iterations.

Note:

When we are specifying the break statement in a loop we are recommended to specify the break statement along with condition.

Program

Continue

continue is a transfer statement which has to be used in loops. The continue statements will skip the current the iteration and continues with the remaining iterations.

Note:

When we are specifying a continue in a loop, then we are recommended to specify the continue statement along with condition.

Program

 

Leave a Reply