Javatpoint Logo
Javatpoint Logo

Python continue Statement

The continue statement in Python is used to bring the program control to the beginning of the loop. The continue statement skips the remaining lines of code inside the loop and start with the next iteration. It is mainly used for a particular condition inside the loop so that we can skip some specific code for a particular condition.The continue statement in Python is used to bring the program control to the beginning of the loop. The continue statement skips the remaining lines of code inside the loop and start with the next iteration. It is mainly used for a particular condition inside the loop so that we can skip some specific code for a particular condition.

Syntax

Flow Diagram

Python continue Statement

Consider the following examples.

Example 1

Output:

1
2
3
4
6
7
8
9
10

Observe the output of above code, the value 5 is skipped because we have provided the if condition using with continue statement in while loop. When it matched with the given condition then control transferred to the beginning of the while loop and it skipped the value 5 from the code.

Let's have a look at another example:

Example 2

Output:

J
a
v
a
p
o
i
n
t

Pass Statement

The pass statement is a null operation since nothing happens when it is executed. It is used in the cases where a statement is syntactically needed but we don't want to use any executable statement at its place.

For example, it can be used while overriding a parent class method in the subclass but don't want to give its specific implementation in the subclass.

Pass is also used where the code will be written somewhere but not yet written in the program file. Consider the following example.

Example

Output:

Current element: 1 Current element: 2 Current element: 3 
We are inside pass block


Came out of pass

Current element: 4 Current element: 5 

We will learn more about the pass statement in the next tutorial.


Next TopicPython Pass




Youtube For Videos Join Our Youtube Channel: Join Now

Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA