1. break sentence

1. break sentence

bThe break statement can only be used in switch statements or loop statements, and its function is to jump out of the switch statement or the current loop and proceed to execute the subsequent program. Since the transition direction of the break statement is clear, there is no need for the statement label to match it.

The general form of a break statement is:

break;  

In the above example, the break statement was used as a jump in both the switch statement and the for statement. The use of break statements can provide multiple exits for loop statements, making programming more flexible and convenient in some situations.