break

Use the break statement to terminate a loop, switch, or label statement.

Terminates the current loop, switch, or label statement and transfers program control to the statement following the terminated loop.

Syntax

break [label]

Parameter

label Identifier associated with the label of the statement.

Description

The break statement includes an optional label that allows the program to break out of a labeled statement. The statements in a labeled statement can be of any type.

Examples

Example 1. The following function has a break statement that terminates the while loop when e is 3, and then returns the value 3 * x.

See also

continue, label, switch

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.