Skip to content

Commit e5d8e71

Browse files
authored
Update break-statement-cpp.md
While we are here, added missing code escape. Made the output match what you'll actually see.
1 parent 239b288 commit e5d8e71

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

docs/cpp/break-statement-cpp.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ The **`break`** statement ends execution of the nearest enclosing loop or condit
1212

1313
## Syntax
1414

15-
```
15+
```cpp
1616
break;
1717
```
1818

1919
## Remarks
2020

21-
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.
21+
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.
2222

2323
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.
2424

@@ -58,7 +58,9 @@ int nums []{1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
5858
```
5959

6060
```Output
61-
In each case:
61+
1
62+
2
63+
3
6264
1
6365
2
6466
3
@@ -93,7 +95,10 @@ int main() {
9395
```
9496

9597
```Output
96-
In each case:
98+
0
99+
1
100+
2
101+
3
97102
0
98103
1
99104
2

0 commit comments

Comments
 (0)