I
last month
Iancountry asked

Does continue in a loop skip the boolean expression, or just the rest of the iteration?

Abhay Jajodia
Expert
last month
Abhay Jajodia answered

Hi Ian,

continue does not skip the loop condition. It only skips the rest of the code in the loop body for that one round, then the loop checks the condition again and moves to the next iteration.

Example:

for i in range(1, 6):
    if i == 3:
        continue
    print(i)  # prints 1, 2, 4, 5

If you have more questions, I am here to help.

C++
This question was asked as part of the Learn C++ Basics course.