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
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-continue-statement
Python Continue Statement - GeeksforGeeks
Explanation: Whenever char == 'e', the continue statement executes, skipping the print function for that iteration. Example 2. Using continue in nested loops
Published   3 days ago
Discussions

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
Python: Continuing to next iteration in outer loop - Stack Overflow
I wanted to know if there are any built-in ways to continue to next iteration in outer loop in python. For example, consider the code: for ii in range(200): for jj in range(200, 400): ... More on stackoverflow.com
🌐 stackoverflow.com
(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
Example to understand use of 'break' and 'continue' in loops.
While in a loop, break terminates the loop execution and continues to the next instruction. continue, on the other hand, instructs the loop to begin the next iteration immediately. Say you had a loop like this: a = True counter = 0 while True: counter += 1 if a == True: print("Ending loop!") break if counter % 2 != 0: continue print(counter) print("Got out of the loop!") If you were to run this code, you'd get Ending loop! Got out of the loop! And if a had any other value, you'd just get an infinite loop printing even numbers. As I said, break terminates the loop that is currently in scope. It raises an error if you use it without being in a loop. This is why also the code below the loop is executed. The continue essentially skips everything inside the loop before it and starts over from the top. More on reddit.com
🌐 r/learnpython
21
9
July 8, 2017
🌐
Programiz
programiz.com › python-programming › break-continue
Python break and continue (With Examples)
For example, # Program to print odd numbers from 1 to 10 num = 0 while num < 10: num += 1 if (num % 2) == 0: continue print(num) ... In the above example, we have used the while loop to print the odd numbers between 1 and 10. Here, ... Before we wrap up, let’s put your knowledge of Python ...
🌐
W3Schools
w3schools.com › python › ref_keyword_continue.asp
Python continue Keyword
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Certificate Python 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.
🌐
Real Python
realpython.com › python-continue
Skip Ahead in Loops With Python's continue Keyword – Real Python
March 27, 2025 - Assume you have the following for loop that computes the sum of all numbers in a list: ... This works fine, but what if you want to add only the positive numbers, ignoring all the negative ones? You can modify this loop to add only positive numbers using continue: ... In this case, since Python executes continue only when the number is less than zero, it doesn’t add those numbers to total.
🌐
Tutorialspoint
tutorialspoint.com › python › python_continue_statement.htm
Python - Continue Statement
num = 60 print ("Prime factors for: ", num) d=2 while num > 1: if num%d==0: print (d) num=num/d continue d=d+1
🌐
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 »
Find elsewhere
🌐
W3Schools
w3schools.com › python › python_for_loops.asp
Python For Loops
Exit the loop when x is "banana", but this time the break comes before the print: fruits = ["apple", "banana", "cherry"] for x in fruits: if x == "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:
🌐
Tutorialspoint
tutorialspoint.com › python › python_loop_control.htm
Python Break, Continue and Pass Statements
The continue statement can be used in both while and for loops. for letter in 'Python': # First Example if letter == 'h': continue print ('Current Letter :', letter) var = 10 # Second Example while var > 0: var = var -1 if var == 5: continue ...
🌐
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 ...
🌐
Python documentation
docs.python.org › 3 › tutorial › controlflow.html
4. More Control Flow Tools — Python 3.14.3 documentation
For example (no pun intended): >>> # Measure some strings: >>> words = ['cat', 'window', 'defenestrate'] >>> for w in words: ... print(w, len(w)) ... cat 3 window 6 defenestrate 12 · Code that modifies a collection while iterating over that same collection can be tricky to get right. Instead, it is usually more straight-forward to loop over a copy of the collection or to create a new collection:
🌐
CodeSignal
codesignal.com › learn › courses › exploring-iterations-and-loops-in-python › lessons › mastering-loop-controls-break-and-continue-in-python
Mastering Loop Controls: Else, Break and Continue in Python
In this example, the continue statement skips the rest of the loop body for items that are already packed, allowing the loop to only print out the items that still need to be packed. This way, we efficiently focus on what is left to be packed without unnecessary checks or reminders for already ...
🌐
Boot.dev
boot.dev › lessons › 3f2e485c-fcc2-419c-8664-f4b6318b4c7f
Learn to Code in Python: Continue Statement | Boot.dev
continue means "go directly to the next iteration of this loop." Whatever else was supposed to happen in the current iteration is skipped. Let's say we want to print all the numbers from 1 to 50, but skip every 7th number.
🌐
Built In
builtin.com › software-engineering-perspectives › pass-vs-continue-python
Pass vs. Continue in Python Explained | Built In
More on Python: 3 Ways to Write Pythonic Conditional Statements · The continue statement is used to skip the remaining code inside a loop for the current iteration only. For instance, let’s use continue instead of a break statement in the previous example.
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python for loop continue and break
Python For Loop Continue And Break - Spark By {Examples}
April 17, 2024 - The example is given below. If the break statement is inside a nested loop, the break statement will end the innermost loop and the outer loop continue executing. ... # Using break statement inside the nested loop ourses1=["java","python"] ...
🌐
Python Tutorial
pythontutorial.net › home › python basics › python continue
Using Python continue Statement to Control the Loops
March 26, 2025 - for index in range(n): if condition: continue # more code hereCode language: Python (python) And the following illustrates how to use the continue statement in a while loop: while condition1: if condition2: continue # more code hereCode language: Python (python) The following example shows how to use the for loop to display even numbers from 0 to 9:
🌐
GeeksforGeeks
geeksforgeeks.org › python › loops-in-python
Loops in Python - GeeksforGeeks
Explanation: The continue statement is used to skip the current iteration of a loop and move to the next iteration. It is useful when we want to bypass certain conditions without terminating the loop. The break statement in Python brings control out of the loop. ... for letter in 'geeksforgeeks': if letter == 'e' or letter == 's': break print('Current Letter :', letter)
Published   1 month ago
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.

🌐
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 - This article provides a comprehensive guide to using Python’s break, continue, and pass statements within loops to control flow effectively. It explains the purpose and behavior of each statement with practical code examples and output demonstrations. The article also explores advanced loop control techniques, including methods for ...