Using the Python continue Statement: Guide and Examples

Rumman Ansari   Software Engineer   2024-07-23 09:35:48   5853  Share
Subject Syllabus DetailsSubject Details
☰ TContent
☰Fullscreen

Table of Content:

With the continue statement we can stop the current iteration of the loop, and continue with the next:

Example

Do not print atnyla:

Code:


name = ["python", "atnyla", "code"]
for x in name:
  if x == "atnyla":
    continue
  print(x) 

Output:

 
 python 
 code



Stay Ahead of the Curve! Check out these trending topics and sharpen your skills.