for val in "varsha": if val == "s": break print(val) print("Loop Terminated")
If break statement is inside a nested loop (loop inside another loop), break will terminate the innermost loop.
Unlike the break, the continue statement skips only the current iteration. The loop doesn’t terminate but continues on with the next iteration.
We will use the same code as above to understand the difference between break and continue. Just replace the break keyword with continue.
for val in "varsha": if val == "s": continue print(val)
The pass is used to fill up the empty blocks of code which need to be executed during runtime but don’t have any code written yet.
For example, let there be a function func() whose functionality is yet not decided.
## If we leave func() empty and call it, it will throw an error.
## pass can be used in such cases
def func(): pass
pass represents a null operation.