Unconditional control statement in Python

  • The Unconditional control statement is way to control the statement without using direct conditions.
  • There are two types :
    • break
    • continue

Break

  • The break statement is used to terminate loops or exit the loops.
  • It is necessary to exit immediately from a loop as soon as the condition is satified.
  • The statements after break statement are skipped.
Syntax:
while condition:
 break
Example of break

Continue

  • Sometime , it is required to skip a part of a body of loop under specific conditions.
  • The working structure of continue is similar as that of that the break statement but difference is that it cannot terminate the loop.
  • It causes the loop to be continued with next iteration after skipping statements in between.
  • Continue statement simply skips statements and continues next iteration.
Syntex:
while condition:
 if condition:
continue
Example of Continue in python