--- id: cpp-conditions-else title: "C++ Else" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["else statement", "C++ else λ¬Έ"] 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: ["cpp", "programming-language", "w3schools", "conditions", "else"] raw_sources: ["https://www.w3schools.com/cpp/cpp_conditions_else.asp"] applied_in: [] github_commit: "" --- # [[CPP Else]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The identical time-of-day (`time < 18`) example and the identical `isDay`-naming advice from C's Else chapter reappear here unchanged β€” confirming that descriptive boolean naming as a pure communication device (not a behavioral change) is a language-agnostic best practice the tutorial deliberately repeats across both C and C++. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`else`** β€” runs a block of code when the paired `if` condition is false. [S1] - **Mutually exclusive branches** β€” exactly one of `if`/`else` executes. [S1] - **Descriptive boolean naming** β€” storing a condition in a variable like `isDay` documents its MEANING. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Basic if/else: `int time = 20; if (time < 18) { cout << "Good day."; } else { cout << "Good evening."; } // Outputs "Good evening."`. [S1] - Same logic with a descriptively-named boolean: `bool isDay = time < 18; if (isDay) { cout << "Good day."; } else { cout << "Good evening."; }`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - ν˜„μž¬κΉŒμ§€ 발견된 λͺ¨μˆœ 사항 μ—†μŒ (No contradictions found in available sources). ## πŸ› οΈ 적용 사둀 (Applied in summary) μ‹œκ°„(time)이 18보닀 μž‘μ€μ§€μ— 따라 "쒋은 ν•˜λ£¨"/"쒋은 저녁"을 좜λ ₯ν•˜λŠ” μ˜ˆμ œκ°€ C 챕터와 λ™μΌν•˜κ²Œ μ‹€μ „ ν™œμš© μ‚¬λ‘€λ‘œ μ œμ‹œλ¨. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Naming a boolean condition descriptively for readability (C++): ```cpp int time = 20; bool isDay = time < 18; if (isDay) { cout << "Good day."; } else { cout << "Good evening."; } ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.82 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C++ Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CPP Conditions]], [[CPP Conditions ElseIf]], [[C Conditions Else]] - **μ°Έμ‘° λ§₯락:** else λ¬Έ β€” else if λ¬Έ(Conditions ElseIf) μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C++ Else β€” https://www.w3schools.com/cpp/cpp_conditions_else.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C++ Else" page (Astra wiki-curation, P-Reinforce v3.1 format).