Control Statements


Control Statements

Statements are always executed in sequential order in the Python programming language. If we want to change the flow of the statements then it is achieved by using conditions.
.
There are three types of condition statements in Python if, if-else, and else if (along with nested if statements) being the main ones.
.
Decision-making through conditions allows us to run a particular section of code without sequentially implementing it. The decisions are made on the account of the particular conditions standing valid.

Loop Control Statements in Python -

In the python programming language, the loop control statements also exist to change the execution in a loop from its typical sequence. As the execution leaves a scope, all of its automatic objects created in that scope gets destroyed. Here is a list of all the control loop statements supported by python:

  • break statement: This statement is used to terminate the loop and then transfer the execution immediately to the statement that follows the loop.
  • continue statement: It makes the loop skip the remaining of its body and then again tests its condition before reiterating.
  • pass statement: In the Python programming language, the pass statement is useful when the statement is syntactically required, but you no longer need any code or command for its execution.