continue Statement


The continue statement in python is used in loop control structure when we immediately need to jump to the next iteration of the loop.

It is used to continue the current flow of the program while skipping the remaining code of the loop after the continue statement. In case of inner loop, it continues to execute in the inner loop.

Syntax:

    # loop statements
    continue
    # code to be skipped        

Example:

    myList = [1, 2, 3, 4, 5]
    for num in myList:
        if num==3:
            continue
        print(num)

Output:

    1
    2
    4
    5