You attempted to use the break keyword outside of a loop. The break keyword is used to terminate a loop or switch statement. It must be embedded in the body of a loop or switch statement. However, a label can follow the break keyword.
Copy Code | |
---|---|
break labelname; |
You only need the labeled form of the break keyword when you are using nested loops or switch statements and need to break out of a loop that is not the innermost one.
To correct this error
-
Make sure the break keyword appears inside an enclosing loop or switch statement.