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: continue statement skips printing 3 and moves to the next iteration, so all numbers except 3 are printed in a single line. Example 3. Using continue with a while loop
Published   2 weeks ago
🌐
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), ...
Discussions

How continue works in while loop
name = 'Jesaa29 Roy' size = len(name) i = 0 while i More on discuss.python.org
🌐 discuss.python.org
0
0
October 18, 2022
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
April 26, 2024
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
Continue statement in while loop python - Stack Overflow
This means that when count is 5, the loop goes to the end and the value of count never increments and gets stuck in an infinite loop. Take a look at break, pass and continue statements ... The continue statement in Python returns the control to the beginning of the current loop. More on stackoverflow.com
🌐 stackoverflow.com
🌐
Tutorialspoint
tutorialspoint.com › python › python_continue_statement.htm
Python - Continue Statement
for letter in 'Python': if letter == 'h': continue print ('Current Letter :', letter) print ("Good bye!") When the above code is executed, it produces the following output − · Current Letter : P Current Letter : y Current Letter : t Current ...
🌐
Programiz
programiz.com › python-programming › break-continue
Python break and continue (With Examples)
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. ... We can use the continue statement with the for loop to skip the current iteration of the loop ...
🌐
Real Python
realpython.com › python-continue
Skip Ahead in Loops With Python's continue Keyword – Real Python
March 27, 2025 - The continue statement jumps to the start of the loop, but it doesn’t prevent execution of the finally block. The code in finally always runs, whether you exit a try block normally, with continue, or when Python raises an exception and moves to except. Now that you’ve read the relevant parts of Python’s documentation and experienced what they mean with code examples...
🌐
W3Schools
w3schools.com › python › gloss_python_for_continue.asp
Python Continue For Loop
fruits = ["apple", "banana", "cherry"] for x in fruits: if x == "banana": continue print(x) Try it Yourself » · Python For Loops Tutorial For Loop Through a String For Break Looping Through a Range For Else Nested Loops For pass
Find elsewhere
🌐
Python.org
discuss.python.org › python help
How continue works in while loop - Python Help - Discussions on Python.org
October 18, 2022 - name = 'Jesaa29 Roy' size = len(name) i = 0 while i < size: if name[i].isspace(): continue print(name[i], end=' ') i = i + 1 #it’s supposed to print name without space “Jessa29Roy”, but the output i…
🌐
LearnDataSci
learndatasci.com › solutions › python-continue
Python Continue - Controlling for and while Loops – LearnDataSci
As mentioned previously, continue is used to skip to the end of the current iteration of a loop. Therefore, Python will only bypass code in situations that trigger continue. For a more complex example, let's say we'd like to iterate through a list of numbers and find the square root of each ...
🌐
Reddit
reddit.com › r/learnpython › when should i use the 'continue' keyword?
r/learnpython on Reddit: When should I use the 'continue' keyword?
April 26, 2024 -

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?

🌐
GeeksforGeeks
geeksforgeeks.org › python › loops-in-python
Loops in Python - GeeksforGeeks
Explanation: loop starts from the first character 'g' and continues until it encounters 'e'. When 'e' is found, the break statement stops the loop immediately. Since 'e' is the value at which the loop stops, it is printed outside the loop.
Published   1 week ago
🌐
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 ...
🌐
Python Tutorial
pythontutorial.net › home › python basics › python continue
Using Python continue Statement to Control the Loops
March 26, 2025 - How it works. First, iterate over a range of numbers from 0 to 9 using a for loop with the range() function. Second, if the index is an odd number, skip the current iteration and start a new one. Note that the index % 2 returns 1 if the index is an odd number and 0 if the index is an even 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.
🌐
AskPython
askpython.com › home › python continue statement
Python continue Statement - AskPython
July 7, 2022 - Python continue statement is used to skip the execution of the current iteration of the loop. We can’t use continue statement outside the loop, it will throw an error as “SyntaxError: ‘continue’ outside loop“. We can use continue statement with for loop and while loops. If the continue statement is present in a nested loop, it skips the execution of the inner loop only.
🌐
Real Python
realpython.com › ref › keywords › continue
continue | Python Keywords – Real Python
In this example, the loop iterates over the range from 0 to 4. When index equals 2, the continue statement is executed, causing the loop to skip the call to print() for that iteration and move to the next number in the range.
🌐
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 - Following are quick examples of how to use a break and continue blocks with python for loop. courses=["java","python","pandas","sparks"] # Example 1 : Using continue in for loop for x in courses: if x=='pandas': continue print(x) # Example 2 ...
🌐
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.