Looping control statements or Unconditional control statement in Python:
- Unconditional control statement is also called a jump statement.
- There are three kinds of jumping statements,
*Break
*Continue
*Pass
Break statement:
- The break statement is used to execute particular blocks only.
If give break statement then it stops the process.
Syntax:
Example program:
Output:
if-condition with break:
else-condition:
Continue statement:
- The continue statement is used inside loops.
- Whenever a continue statement is encountered inside a loop, control directly jumps to the beginning of the loop for the next iteration, skipping the execution of statements inside the loop’s body for the current iteration.
The continue is a special statement which is used within to force the next iteration to happen.
- It is syntactically allowed to appear only within a for or while loop.
Syntax:
Example program:
Output:
Pass statement:
- It is a null operation or default statement.
- It is typically used when an empty need function is required that time use the pass statement.
- It basically the pass statement give or not, working as normal. i.e, with pass and without pass are the same.
No comments:
Post a Comment