The break statement is used in loops (such as for and while loops) and switch statements to terminate their execution prematurely. It allows programmers to exit out of these constructs before reaching their natural end.
Related terms
Continue statement: Similar to break, but instead of terminating completely, it skips remaining code within one iteration and moves on to the next iteration.
Loops within loops, where break statements can be used to exit out of multiple levels of looping.
Switch statement: A control flow statement that allows a variable to be tested for equality against a list of values, and break statements are commonly used within switch cases.