Here's a simple example:

for letter in 'Django':    
    if letter == 'D':
        continue
    print("Current Letter: " + letter)

Output will be:

Current Letter: j
Current Letter: a
Current Letter: n
Current Letter: g
Current Letter: o

It skips the rest of the current iteration (here: print) and continues to the next iteration of the loop.

Answer from Snehal Parmar on Stack Overflow
🌐
Tutorialspoint
tutorialspoint.com › python › python_continue_statement.htm
Python - Continue Statement
Python continue statement is used to skip the execution of the program block and returns the control to the beginning of the current loop to start the next iteration. When encountered, the loop starts next iteration without executing the remaining
🌐
W3Schools
w3schools.com › python › ref_keyword_continue.asp
Python continue Keyword
Python Examples Python Compiler ... Training ... The continue keyword is used to end the current iteration in a for loop (or a while loop), and continues to the next iteration....
Discussions

Example use of "continue" statement in Python? - Stack Overflow
It skips the rest of the current ... of the loop. ... Sign up to request clarification or add additional context in comments. ... I've been thinking for the past three or four days, why would I ever need a 'continue' statement and then I run into this post which in turn helps me with some QA — many thanks! 2016-03-10T05:56:05.593Z+00:00 ... same here, when we write python script (for ... More on stackoverflow.com
🌐 stackoverflow.com
Can't understand "Continue" function in Python statement(for loop, while loop) !!
It jumps directly to the next iteration of a loop. In the code below the continue function skips the print statement below it so that "odd" is only printed on odd numbers. for i in range(10): if i%2==0: print("even") continue print("odd") More on reddit.com
🌐 r/learnpython
20
44
November 9, 2019
When should I use the 'continue' keyword?
Continue is a fairly clean way to skip the rest of the loop code for that element. For example you might have a situation like the following: for element in elements: if element == unusable_edge_case: continue # skip this element if element == problematic: if element == fixable: do-fix-here # apply fix, element is now compatible with the 30-lines-of-code below else: continue # skip this element do 30-lines-of-code here You can rewrite this with nested if/else logic, but it is not pretty and the overall intention will not be as easy to read. You might even mess up the exact nesting logic for if/else. Edit: Reworded the ...lines-of-code... placeholder names. More on reddit.com
🌐 r/learnpython
51
7
December 31, 2023
(Over?)use of continue in for loops in python
I don't see any issue with a standard pattern like: for rec in records: if is_invalid(rec): continue process(rec) I would caution against burying continues in the middle of a body of code as people wouldn't be expecting them, or against having multiple continues, but otherwise it is fine. You might also consider things like filter or itertools.filterfalse as an alternative. More on reddit.com
🌐 r/Python
30
28
November 17, 2021
🌐
Real Python
realpython.com › python-continue
Skip Ahead in Loops With Python's continue Keyword – Real Python
March 27, 2025 - If it’s even, then you square the number and print that value. This results in the same output as when you ran the for loop earlier: ... In both loops, when Python executes the continue statement, it skips the rest of the current iteration.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-continue-statement
Python Continue Statement - GeeksforGeeks
The continue statement in Python is a loop control statement that skips the rest of the code inside the loop for the current iteration and moves to the next iteration immediately.
Published   3 days ago
🌐
Learn Python
learnpython.dev › 02-introduction-to-python › 110-control-statements-looping › 40-break-continue
break, continue, and return :: Learn Python by Nina Zakharenko
break and continue allow you to control the flow of your loops. They’re a concept that beginners to Python tend to misunderstand, so pay careful attention. The break statement will completely break out of the current loop, meaning it won’t run any more of the statements contained inside of it. >>> names = ["Rose", "Max", "Nina", "Phillip"] >>> for name in names: ...
🌐
LearnDataSci
learndatasci.com › solutions › python-continue
Python Continue - Controlling for and while Loops – LearnDataSci
When called, continue will tell Python to skip the rest of the code in a loop and move on to the next iteration. To demonstrate, let's look at how we could use continue to print out multiples of seven between one and fifty. Notice how the print() statement is skipped when the if statement is ...
Find elsewhere
🌐
Built In
builtin.com › software-engineering-perspectives › pass-vs-continue-python
Pass vs. Continue in Python Explained | Built In
Pass: The pass statement in Python ... code. Continue: The continue statement in Python is used to skip the remaining code inside a loop for the current iteration only...
🌐
DigitalOcean
digitalocean.com › community › tutorials › how-to-use-break-continue-and-pass-statements-when-working-with-loops-in-python-3
How to Break Out of Multiple Loops in Python | DigitalOcean
August 7, 2025 - The continue statement causes a program to skip certain factors that come up within a loop but then continue through the rest of the loop. When an external condition is triggered, the pass statement allows you to satisfy Python’s syntactical requirement for a code block without performing ...
🌐
Programiz
programiz.com › python-programming › break-continue
Python break and continue (With Examples)
We can also terminate the while loop using the break statement. For example, i = 0 while i < 5: if i == 3: break print(i) i += 1 ... The continue statement skips the current iteration of the loop and the control flow of the program goes to the next iteration.
🌐
W3Schools
w3schools.com › python › python_for_loops.asp
Python For Loops
Exit the loop when x is "banana", ... break print(x) Try it Yourself » · With the continue statement we can stop the current iteration of the loop, and continue with the next:...
🌐
IONOS
ionos.com › digital guide › websites › web development › python break continue
How to use Python break and continue - IONOS
July 13, 2023 - In this example, the “for” loop should count from 0 to 9. The condition is that the number is smaller than 10 in this loop. You probably already know this arrange­ment from our Python tutorial. A Python break which says that the loop should break when the number 5 is reached can then be inserted. 5 is within the specified range, meaning that the loop will terminate and the code will continue after that.
🌐
Reddit
reddit.com › r/learnpython › when should i use the 'continue' keyword?
r/learnpython on Reddit: When should I use the 'continue' keyword?
December 31, 2023 -

So, I tried searching the group and I found people asking *what* the continue keyword does, which is not my question. I think I understand it. Basically, it just says "hey, if x condition is met do not do what you did to every other element in the loop. Potentially do this instead or Just go to the next item."

The question I have is why should I use it instead of just an if-esle statement,, or if you prefer continue why should I use an if-else and not default to continue.

To put it into context, what is the meaningful difference between the following code blocks:

for i in range(10):
if i == 7:
    print('7? I hate prime numbers bigger than 5!')
    continue
print(f'Woo! I love the number {i}')

and

for i in range(10):
if i == 7:
    print('7? I hate prime numbers bigger than 5!')
else:
    print(f'Woo! I love the number {i}')

Both got me the same result. Is it just a "Python has many ways to do the same thing" deal or am I missing a crucial difference?

🌐
Reddit
reddit.com › r/python › (over?)use of continue in for loops in python
r/Python on Reddit: (Over?)use of continue in for loops in python
November 17, 2021 -

Hi! I don't have much experience (around 3 years of not full-time programming) and was wondering what do you think about the use of 'continue' statement in for loops

In the project I'm working on there is a need to make a lot of validations.What usually happens we program using a lot of 'if' and 'elif' and 'else'So the indentations make the code wider than a Dubai highway...

What I thought about is calling methods for error controlling (logs the issue and returns False)and using continue for the next item in the loop

What do you think?

(Some colleagues tried to create different Classes for each of the validation but IMO it gets the code too twisted and practically impossible to debug - may work in a bigger project)

Top answer
1 of 9
246
for ii in range(200):
    for jj in range(200, 400):
        ...block0...
        if something:
            break
    else:
        ...block1...

Break will break the inner loop, and block1 won't be executed (it will run only if the inner loop is exited normally).

2 of 9
130
for i in ...:
    for j in ...:
        for k in ...:
            if something:
                # continue loop i

In a general case, when you have multiple levels of looping and break does not work for you (because you want to continue one of the upper loops, not the one right above the current one), you can do one of the following

Refactor the loops you want to escape from into a function

def inner():
    for j in ...:
        for k in ...:
            if something:
                return


for i in ...:
    inner()

The disadvantage is that you may need to pass to that new function some variables, which were previously in scope. You can either just pass them as parameters, make them instance variables on an object (create a new object just for this function, if it makes sense), or global variables, singletons, whatever (ehm, ehm).

Or you can define inner as a nested function and let it just capture what it needs (may be slower?)

for i in ...:
    def inner():
        for j in ...:
            for k in ...:
                if something:
                    return
    inner()

Use exceptions

Philosophically, this is what exceptions are for, breaking the program flow through the structured programming building blocks (if, for, while) when necessary.

The advantage is that you don't have to break the single piece of code into multiple parts. This is good if it is some kind of computation that you are designing while writing it in Python. Introducing abstractions at this early point may slow you down.

Bad thing with this approach is that interpreter/compiler authors usually assume that exceptions are exceptional and optimize for them accordingly.

class ContinueI(Exception):
    pass


continue_i = ContinueI()

for i in ...:
    try:
        for j in ...:
            for k in ...:
                if something:
                    raise continue_i
    except ContinueI:
        continue

Create a special exception class for this, so that you don't risk accidentally silencing some other exception.

Something else entirely

I am sure there are still other solutions.

🌐
Python documentation
docs.python.org › 3 › tutorial › controlflow.html
4. More Control Flow Tools — Python 3.14.3 documentation
4.2. for Statements · 4.3. The range() Function · 4.4. break and continue Statements · 4.5. else Clauses on Loops · 4.6. pass Statements · 4.7. match Statements · 4.8. Defining Functions · 4.9. More on Defining Functions · 4.9.1. Default Argument Values ·
🌐
W3Schools
w3schools.com › python › gloss_python_for_continue.asp
Python Continue For Loop
With the continue statement we can stop the current iteration of the loop, and continue with the next: ... fruits = ["apple", "banana", "cherry"] for x in fruits: if x == "banana": continue print(x) Try it Yourself »
🌐
Python.org
discuss.python.org › ideas
Breaking/continuing out of multiple loops - Ideas - Discussions on Python.org
August 21, 2022 - Hi! SUGGESTION An easy way to break/continue within nested loops. MY REAL LIFE EXAMPLE I am looping through a list of basketball players, each of which has multiple tables, each of which can have up to three different versions. I manipulate data in the deepest loop and, if some key data is ...