break statements can alter the flow of a normal loop.
Loops iterate over a block of code until the test expression is false, but sometimes we wish to terminate the current iteration or even the whole loop without checking the test expression. The
break statements are used in these cases.
break statement terminates the loop containing it. Control of the program flows to the statement immediately after the body of the loop.
break statement is inside a nested loop, the
break statement will terminate the innermost loop.
# example # break s = "python" for i in s: if i == "o": break print(i, end = " ") print("-")
p y t h -