How does break, continue and pass work in python?



First of all I would like to say that you should have the knowledge of loops before reading this.In this article we will discuss loops in short to help you understand this concept in better way.Loops are often called Iteration statement those statements which repeats specific number of times or based on specific condition.for loops and while loops are the loops supported in python.

  • Break statement is used when the programmer need to terminate a part of loop.It is a very useful statement.  
  • Continue statement is used when you have to perform an iteration certain number of times and after the completion of iteration the other statements are executed.
  • Pass is only supported in Python Programming Language.While Programming is python you often need to declare variables and functions explicitly but they actually don't need to be placed in the syntax and as we have to leave them empty that'swhy they create error.So Pass statement can be used there.

Comments

Popular posts from this blog

5 Best Java frameworks

Collections — Container Datatypes - Python