--- id: c-conditions title: "C If ... Else" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["if statement", "lowercase if", "C 쑰건문"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.86 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["c", "programming-language", "w3schools", "conditions", "if-statement"] raw_sources: ["https://www.w3schools.com/c/c_conditions.php"] applied_in: [] github_commit: "" --- # [[C If ... Else]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) Case sensitivity isn't just a general C rule mentioned in passing β€” this chapter singles it out specifically for `if`, explicitly warning that `If` or `IF` will generate an error, meaning the keyword has zero tolerance for capitalization variants despite `if` being one of the most frequently typed words in any C program. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Six comparison conditions** β€” `<`, `<=`, `>`, `>=`, `==`, `!=`, familiar from mathematics. [S1] - **Four conditional constructs** β€” `if` (run code if true), `else` (run if false), `else if` (test a new condition if the first is false), `switch` (many alternative code blocks). [S1] - **Case-sensitive keyword** β€” `if` must be lowercase; `If`/`IF` produce an error. [S1] - **Boolean-variable readability pattern** β€” storing a comparison's result in a `bool` variable before using it in `if` makes complex or reused conditions easier to read. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Basic if with literal values: `if (20 > 18) { printf("20 is greater than 18"); }`. [S1] - If with variables: `int x = 20; int y = 18; if (x > y) { printf("x is greater than y"); }`. [S1] - Using a boolean variable to hold the condition: `bool isGreater = x > y; if (isGreater) { printf("x is greater than y"); }` (requires ``). [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **ifλŠ” λ°˜λ“œμ‹œ μ†Œλ¬Έμž**: Ifλ‚˜ IF처럼 λŒ€μ†Œλ¬Έμžλ₯Ό λ‹€λ₯΄κ²Œ μ“°λ©΄ μ—λŸ¬κ°€ λ°œμƒν•œλ‹€λŠ” 점이 λͺ…μ‹œμ μœΌλ‘œ 경고됨. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” λ³΅μž‘ν•˜κ±°λ‚˜ μž¬μ‚¬μš©λ˜λŠ” 쑰건을 bool λ³€μˆ˜μ— 미리 λ‹΄μ•„λ‘λŠ” νŒ¨ν„΄μ΄ 가독성 μžˆλŠ” 쑰건문 μž‘μ„±μ˜ μ‹€μ „ 관행이닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Storing a condition in a readable boolean variable before using it in an if statement (C): ```c int x = 20; int y = 18; bool isGreater = x > y; if (isGreater) { printf("x is greater than y"); } ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.86 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[C Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[C Booleans RealLife]], [[C Conditions Else]] - **μ°Έμ‘° λ§₯락:** 쑰건문 μ„Ήμ…˜ 첫 챕터 β€” else λ¬Έ(Conditions Else) μ±•ν„°λ‘œ 이어짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” C If ... Else β€” https://www.w3schools.com/c/c_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).