Break out of the loop and continue the difference

break terminates the current cycle:
break in the loop must be used ----
break ---- terminates the current through the bad and the code below the break statement

continue out of this cycle, the next cycle continues (disguised as the last loop line of code)
continue ---- out this cycle, continue to the next cycle (the last line of code in the loop body disguised)
continue ---- be used in a loop, and continue the code will not be executed below the

 

 

 
for i in range(0,100,5):
    print("-------------",i)
    for j in range(10):
        if j > 5:
            continue
        else:
            print(j)
 

 

 

 

Guess you like

Origin www.cnblogs.com/weimang/p/11411267.html