Break |
The break statement terminates the loop immediately
and the control flows to the statement after the body of the loop. |
Continue |
The continue statement terminates the current iteration of the statement,
skips the rest of the code in the current iteration and the control flows to the next iteration of the loop. |
Pass |
As explained above, pass keyword in Python is generally used to fill-up empty blocks
and is similar to an empty statement represented by a semi-colon in languages such as Java, C++, Javascript etc. |
pat = [1, 3, 2, 1, 2, 3, 1, 0, 1, 3]
for p in pat:
pass
if (p == 0):
current = p
break
elif (p % 2 == 0):
continue
print(p) # output => 1 3 1 3 1
<strong style="-webkit-font-smoothing:subp