continue forces the loop to start at the next iteration. In short, continue will jump back to the top of the loop
a = [0, 1, 2] for element in a: if not element: continue print(element)
UseCase: The continue statement can be used to skip the current iteration only. Loop does not terminate but continues on with the next iteration.
while pass means there is no code to execute here, it passes execution to the next statement. So pass will continue processing.
a = [0, 1, 2] for element in a: if not element: pass print(element)
0 1 2
UseCase: You can use pass statement when you have created a method but have not implemented, yet.
The break statement provides you with the opportunity to exit out of a loop when a given condition is triggered.
a = [0, 1, 2, 3, 4, 5] for element in a: if element == 3: break print(element)
0 1 2
UseCase: The break statement can use in a program to break out of a loop for the matching condition.
We share the every post update using our telegram bot,