docs(10_Wiki): Topic_Business/General/Graphic/Programming을 Topics/ 하위로 이동

최상위 10_Wiki/Topic_*였던 4개 카테고리 폴더를 10_Wiki/Topics/Topic_* 로 재배치.
콘텐츠 변경 없음(순수 폴더 이동) — Topics/ 하위 나머지 폴더는 이미 지난 커밋에서
전부 정리된 상태(잔존 항목은 에이전트 운영 상태 및 사용자가 보존을 요청한
업데이트0615/무제 3.canvas 뿐).
This commit is contained in:
Antigravity Agent
2026-07-05 00:44:01 +09:00
parent e9cbf23ab5
commit 9a135bd19d
6127 changed files with 0 additions and 0 deletions
@@ -0,0 +1,75 @@
---
id: cpp-break
title: "C++ Break and Continue"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["break statement", "continue statement", "loop control", "C++ break continue"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.84
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["cpp", "programming-language", "w3schools", "loops", "break", "continue"]
raw_sources: ["https://www.w3schools.com/cpp/cpp_break.asp"]
applied_in: []
github_commit: ""
---
# [[CPP Break and Continue]]
## 🎯 한 줄 통찰 (One-line insight)
The break-in-while example places `i++` BEFORE the `if (i == 4) break;` check, deliberately different ordering from the continue-in-while example (which places `i++` inside the `if` block before `continue`) — a subtle structural detail showing that where the increment sits relative to the break/continue check must be deliberately designed per-case to avoid either skipping a value or looping forever, unlike a `for` loop where the increment is guaranteed to run automatically regardless of `continue`. [S1]
## 🧠 핵심 개념 (Core concepts)
- **`break`** — stops the loop COMPLETELY. [S1]
- **`continue`** — skips the REST of the current iteration and jumps to the next one. [S1]
- **Works in both `for` and `while` loops** — same semantics apply regardless of loop type. [S1]
- **Increment placement matters in `while` loops** — unlike `for` loops (where the increment always runs), a `while` loop's increment must be manually placed correctly relative to `continue`, or the loop may infinite-loop or skip incorrectly. [S1]
## 📖 세부 내용 (Details)
- `break` stopping a for loop at i==4: `for (int i = 0; i < 10; i++) { if (i == 4) { break; } cout << i << "\n"; }` — prints 0,1,2,3 then stops entirely. [S1]
- `continue` skipping just one value: `for (int i = 0; i < 10; i++) { if (i == 4) { continue; } cout << i << "\n"; }` — prints 0,1,2,3,5,6,7,8,9. [S1]
- `break` in a while loop (increment BEFORE the break check): `int i = 0; while (i < 10) { cout << i << "\n"; i++; if (i == 4) { break; } }`. [S1]
- `continue` in a while loop (increment INSIDE the if, before continue, to avoid an infinite loop): `int i = 0; while (i < 10) { if (i == 4) { i++; continue; } cout << i << "\n"; i++; }`. [S1]
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **while 루프에서는 증가식 위치를 직접 설계해야 함**: for 루프와 달리 while 루프는 증가식(i++)이 자동으로 실행되지 않으므로, continue를 쓸 때는 continue 이전에 반드시 i++을 넣어야 무한루프를 피할 수 있다는 점이 두 예제(break용/continue용)의 서로 다른 i++ 배치로 확인됨. [S1]
## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — while 루프에서 continue를 쓸 때 증가식을 continue 이전에 두어야 무한루프를 방지한다는 점이 실전 디버깅에서 흔히 놓치는 함정으로 시사된다. [S1]
## 💻 코드 패턴 (Code patterns)
Placing the increment before continue in a while loop to avoid an infinite loop (C++):
```cpp
int i = 0;
while (i < 10) {
if (i == 4) {
i++; // must increment before continue
continue;
}
cout << i << "\n";
i++;
}
```
## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.84
- **중복 검사 결과:** 신규 생성 (New discovery)
## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[C++ Tutorial]]
- **관련 개념:** [[CPP For Loop RealLife]], [[CPP Switch]], [[CPP Arrays]]
- **참조 맥락:** 반복문 섹션 마지막 — 배열(Arrays) 섹션으로 이어짐.
## 📚 출처 (Sources)
- [S1] W3Schools — C++ Break and Continue — https://www.w3schools.com/cpp/cpp_break.asp
## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "C++ Break and Continue" page (Astra wiki-curation, P-Reinforce v3.1 format).