Control Statements

Control statements in Python are constructs designed to manage the flow of your program's execution. They empower you to make choices, iterate actions, and bypass specific sections of your code contingent on particular conditions.

In python, there are three control statements given below:

  1. pass
  2. continue
  3. break

Pass Statement

When you write a loop, it can not be empty. You have to write some code in it. But if you do not want to write code and still need for loop, you can use pass statement to pass all the iterations to avoid getting error.

Continue Statement

In loops, continue statement is used to skip the current iteration. For example, we say that if counter variable has some specified value, then continue. It means that skip the iteration at specified value. The continue statements are executed along with if statement.

Break Statement

In loops, break statement is used to skip all iterations after the variable has a specified value. For example, we say that if counter variable has some specified value, then break. It means that skip all the iterations after that specified value. The break statements are executed along with if statement.

Practice Exercises

Complete these exercises to reinforce your learning and earn XP

Sign in to track your progress and earn XP!
Exercise 1 of 2Easy

Which of the following is a best practice in programming?

10 XP~2 min
Exercise 2 of 2Easy

Code that is easy to read and understand is called ___ code.

10 XP~2 min