---
id: csharp-break
title: "C# Break and Continue"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["break continue C#", "C# break continue"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.82
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["csharp", "programming-language", "w3schools", "loops", "break", "continue"]
raw_sources: ["https://www.w3schools.com/cs/cs_break.php"]
applied_in: []
github_commit: ""
---

# [[CSharp Break]]

## 🎯 한 줄 통찰 (One-line insight)
This chapter explicitly ties `break` back to the Switch chapter ("You have already seen the break statement used... to jump out of a switch statement"), making the point that `break` is ONE keyword with TWO distinct jump targets (switch block vs. loop) — while `continue` is entirely new here, skipping only the CURRENT iteration rather than exiting entirely; both keywords and their exact semantics are identical to C/C++, but the while-loop `continue` example reveals a subtle placement rule: the increment (`i++`) must happen BEFORE `continue` inside a `while` loop (unlike a `for` loop, where the increment happens automatically), or the loop would spin forever on the skipped value. [S1]

## 🧠 핵심 개념 (Core concepts)
- **`break`** — already introduced for exiting a `switch` block; here reused to exit a LOOP entirely (for or while), stopping all further iterations immediately. [S1]
- **`continue`** — skips the REST of the current iteration only, then proceeds to the next iteration; does not exit the loop. [S1]
- **`for` loop placement** — both `break` and `continue` are placed inside a conditional check (`if (i == 4) { break; }` / `{ continue; }`) within the loop body. [S1]
- **`while` loop placement subtlety** — in a `while` loop, `continue` must be preceded by the manual increment (`i++; continue;`), because `continue` jumps straight back to the condition check, skipping any code after it — including an increment that would otherwise appear later in the body. [S1]

## 📖 세부 내용 (Details)
- `break` in a `for` loop: `for (int i = 0; i < 10; i++) { if (i == 4) { break; } Console.WriteLine(i); }` → prints 0,1,2,3 then stops entirely at 4. [S1]
- `continue` in a `for` loop: `for (int i = 0; i < 10; i++) { if (i == 4) { continue; } Console.WriteLine(i); }` → prints 0,1,2,3,5,6,7,8,9 (skips only 4). [S1]
- `break` in a `while` loop: increment happens BEFORE the break check (`i++; if (i == 4) { break; }`). [S1]
- `continue` in a `while` loop: increment happens BEFORE `continue` is called (`if (i == 4) { i++; continue; }`), specifically to avoid an infinite loop that would otherwise keep re-testing `i == 4` forever. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **break가 switch와 loop 두 곳에서 재사용되는 동일 키워드임을 명시**: 이번 챕터는 break가 switch 챕터에서 이미 배운 것과 같은 키워드이며, 단지 탈출 대상이 switch 블록에서 루프로 바뀔 뿐이라는 점을 직접 언급함 — C/C++와 마찬가지로 하나의 키워드가 문맥에 따라 다른 블록을 탈출하는 데 재사용됨. [S1]
- **while 루프에서 continue 앞에 증감식이 반드시 와야 함**: for 루프는 증감(statement3)이 자동으로 실행되지만, while 루프는 continue가 조건 검사로 바로 점프하므로 continue보다 먼저 i++를 실행해두지 않으면 무한 루프가 발생한다는 점이 while 루프 continue 예제에서 확인됨. [S1]

## 🛠️ 적용 사례 (Applied in summary)
i==4일 때 루프를 완전히 탈출(break)하는 예제와, i==4만 건너뛰고 나머지는 계속 출력(continue)하는 예제가 for/while 양쪽 모두에서 원문에 직접 제시됨. [S1]

## 💻 코드 패턴 (Code patterns)
continue in a while loop — increment must come first to avoid infinite loop (C#):
```csharp
int i = 0;
while (i < 10)
{
    if (i == 4)
    {
        i++;       // must increment BEFORE continue
        continue;
    }
    Console.WriteLine(i);
    i++;
}
```

## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.82
- **중복 검사 결과:** 신규 생성 (New discovery)

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[C# Tutorial]]
- **관련 개념:** [[CSharp Foreach Loop]], [[CSharp Switch]], [[CSharp Arrays]], [[CPP Break]]
- **참조 맥락:** Loops 섹션의 마지막 챕터 — Arrays 섹션으로 이어짐.

## 📚 출처 (Sources)
- [S1] W3Schools — C# Break and Continue — https://www.w3schools.com/cs/cs_break.php

## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C# Break and Continue" page (Astra wiki-curation, P-Reinforce v3.1 format).
