The break statement is used to terminate the loop completely when a condition becomes true.
for i in range(5): if i == 3: break print(i) #output 0 1 2 i = 1 while i <= 5: if i == 3: break print(i) i += 1 #output 1 2 Continue Statement :
The continue statement skips the current loop iteration and moves to the next one
for i in range(5): if i == 3: continue print(i) #output 0 1 2 4 i = 0 while i < 5: i += 1 if i == 3: continue print(i) #output 0 1 2 4 Pass Statement :
The pass statement is used when a block is required syntactically but no action is needed.
for i in range(5): if i == 3: pass print(i) #output 0 1 2 3 4