---
description: "Learn more about: break Statement (C++)"
title: "break Statement (C++)"
ms.date: "11/04/2016"
f1_keywords: ["break_cpp"]
helpviewer_keywords: ["break keyword [C++]"]
---
# `break` statement (C++)
The **`break`** statement ends execution of the nearest enclosing loop or conditional statement in which it appears. Control passes to the statement that follows the end of the statement, if any.
## Syntax
```cpp
break;
```
## Remarks
The **`break`** statement is used with the conditional [`switch`](../cpp/switch-statement-cpp.md) statement and with the [`do`](../cpp/do-while-statement-cpp.md), [`for`](../cpp/for-statement-cpp.md), and [`while`](../cpp/while-statement-cpp.md) loop statements.
In a **`switch`** statement, the **`break`** statement causes the program to execute the next statement outside the **`switch`** statement. Without a **`break`** statement, every statement from the matched **`case`** label to the end of the **`switch`** statement, including the **`default`** clause, is executed.
In loops, the **`break`** statement ends execution of the nearest enclosing **`do`**, **`for`**, or **`while`** statement. Control passes to the statement that follows the ended statement, if any.
Within nested statements, the **`break`** statement ends only the **`do`**, **`for`**, **`switch`**, or **`while`** statement that immediately encloses it. You can use a **`return`** or **`goto`** statement to transfer control from more deeply nested structures.
## Example
The following code shows how to use the **`break`** statement in a **`for`** loop.
```cpp
#include
[Keywords](../cpp/keywords-cpp.md)
[continue Statement](../cpp/continue-statement-cpp.md)