--- id: csharp-conditions title: "C# If ... Else" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["if statement C#", "C# 쑰건문"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.83 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["csharp", "programming-language", "w3schools", "conditions", "if"] raw_sources: ["https://www.w3schools.com/cs/cs_conditions.php"] applied_in: [] github_commit: "" --- # [[CSharp Conditions]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The `if (condition) { ... }` syntax is byte-identical to C/C++/Java, and the chapter's own explicit warning β€” "if is in lowercase letters; If or IF will generate an error" β€” is the same case-sensitivity rule already established in the Identifiers chapter, now applied to KEYWORDS rather than variable names, closing the loop on C#'s case-sensitivity being a blanket rule across the entire language (identifiers AND keywords), not just a variable-naming quirk. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Comparison conditions inherited from math** β€” `<`, `<=`, `>`, `>=`, `==`, `!=`, already covered in the Comparison Operators chapter, are the building blocks of every condition. [S1] - **Four conditional constructs previewed** β€” `if` (execute if true), `else` (execute if false), `else if` (test a new condition if the first was false), `switch` (many alternative blocks). [S1] - **`if` syntax**: `if (condition) { // code }` β€” code inside the braces runs only when `condition` evaluates to `True`. [S1] - **Case-sensitivity applies to keywords, not just identifiers** β€” `If` or `IF` (capitalized) is a compile error; only lowercase `if` is valid. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Literal condition: `if (20 > 18) { Console.WriteLine("20 is greater than 18"); }`. [S1] - Variable condition: `int x = 20; int y = 18; if (x > y) { Console.WriteLine("x is greater than y"); }`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **λŒ€μ†Œλ¬Έμž ꡬ뢄이 ν‚€μ›Œλ“œμ—λ„ μ μš©λ¨μ„ λͺ…μ‹œμ μœΌλ‘œ 확인**: Identifiers μ±•ν„°μ—μ„œ λ³€μˆ˜λͺ…μ˜ λŒ€μ†Œλ¬Έμž ꡬ뢄(`myVar` vs `myvar`)을 λ°°μ› λŠ”λ°, 이번 μ±•ν„°λŠ” `if`λΌλŠ” ν‚€μ›Œλ“œ μžμ²΄λ„ λŒ€λ¬Έμžλ‘œ μ“°λ©΄(`If`, `IF`) μ—λŸ¬κ°€ λ‚œλ‹€κ³  λͺ…μ‹œ β€” λŒ€μ†Œλ¬Έμž ꡬ뢄이 μ‹λ³„μžλΏ μ•„λ‹ˆλΌ μ–Έμ–΄ 전체(ν‚€μ›Œλ“œ 포함)에 μ μš©λ˜λŠ” κ·œμΉ™μž„μ΄ 확인됨. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” λ¦¬ν„°λŸ΄ 비ꡐ(20 > 18)와 λ³€μˆ˜ 비ꡐ(x > y) 두 κ°€μ§€ if μ˜ˆμ œκ°€ μ›λ¬Έμ—μ„œ μ œμ‹œλ¨. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Basic if statement β€” lowercase `if` only (C#): ```csharp int x = 20; int y = 18; if (x > y) { Console.WriteLine("x is greater than y"); } ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.83 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C# Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[CSharp Booleans]], [[CSharp Conditions Else]], [[CPP Conditions]] - **μ°Έμ‘° λ§₯락:** Conditions μ„Ήμ…˜ β€” The else Statement μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C# If ... Else β€” https://www.w3schools.com/cs/cs_conditions.php ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C# If ... Else" page (Astra wiki-curation, P-Reinforce v3.1 format).