p

python tutorial - Python Continue | Continue Statement Python - learn python - python programming



What is continue statement in python?

  • Python continue statement, it returns the control to the beginning of the while loop.
  • The continue statement rejects all the remaining statements in the current iteration of the loop and moves the control back to the top of the loop.
  •  python continue

    Learn Python - Python tutorial - python continue - Python examples - Python programs

  • The continue statement can be used in both while and for loops.
  • Continue Statement is a jump statement that is used to skip the present iteration and forces next iteration of loop to take place.
 python continue statement

Example:

  • Program to show the use of continue statement inside loops
for val in "string":
    if val == "i":
        continue
    print(val)
print("The end")

Output:

s
t
r
n
g
The end
  • We continue with the loop, if the string is "i", not executing the rest of the block. Hence, we see in our output that all the letters except "i" gets printed.

Flow chart of continue:

 flow chart continue statement python


Wikitechy tutorial site provides you all the learn python , python programming online training , python course online , python programming course

Related Searches to continue statement python