--- id: csharp-operators-logical title: "C# Logical Operators" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["&& || ! C#", "C# 논리 연산자"] 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", "operators", "logical"] raw_sources: ["https://www.w3schools.com/cs/cs_operators_logical.php"] applied_in: [] github_commit: "" --- # [[CSharp Logical Operators]] ## 🎯 한 줄 통찰 (One-line insight) The three logical operators (`&&`, `||`, `!`) use the exact same symbols and short-circuit-implying descriptions ("returns True if BOTH statements are true" / "if ONE of the statements is true") as C/C++ — the only genuinely new element in this short chapter is that the operators combine `bool`-typed comparison results (themselves real `True`/`False` values, per the previous chapter) rather than C's 1/0 integer stand-ins, making a chain like `x < 5 && x < 10` operate on two authentic boolean values instead of two truthy integers. [S1] ## 🧠 핵심 개념 (Core concepts) - **`&&` (logical AND)** — returns `True` only if BOTH operand statements are true. [S1] - **`||` (logical OR)** — returns `True` if AT LEAST ONE operand statement is true. [S1] - **`!` (logical NOT)** — reverses the result: returns `False` if the inner expression is true (and vice versa). [S1] - **Combines with comparison operators** — logical operators are typically used to chain multiple comparison expressions together (e.g. `x < 5 && x < 10`). [S1] - **Deferred depth** — the tutorial explicitly defers deeper coverage to the upcoming Booleans and If...Else chapters. [S1] ## 📖 세부 내용 (Details) - AND example: `x < 5 && x < 10`. [S1] - OR example: `x < 5 || x < 4`. [S1] - NOT example: `!(x < 5 && x < 10)`. [S1] ## ⚖️ 모순 및 업데이트 (Contradictions & updates) - **연산자 기호와 의미는 C/C++와 동일, 피연산자 타입만 실질적 bool로 확인됨**: `&& || !` 세 연산자의 기호와 논리는 C/C++와 차이가 없지만, Comparison Operators 챕터에서 확인된 것처럼 이 연산자들이 결합하는 대상이 진짜 bool 값이라는 점이 C의 정수 기반 논리 판정과의 실질적 차이로 재확인됨. [S1] ## 🛠️ 적용 사례 (Applied in summary) 현재 발견된 실제 적용 사례가 없습니다 — AND/OR/NOT 각각의 최소 예제식이 원문에서 제시됨. [S1] ## 💻 코드 패턴 (Code patterns) Logical AND/OR/NOT combining bool comparison results (C#): ```csharp bool r1 = (x < 5 && x < 10); // AND -- both must be true bool r2 = (x < 5 || x < 4); // OR -- at least one must be true bool r3 = !(x < 5 && x < 10); // NOT -- reverses the result ``` ## ✅ 검증 상태 및 신뢰도 - **상태:** draft - **검증 단계:** conceptual - **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body) - **신뢰 점수:** 0.82 - **중복 검사 결과:** 신규 생성 (New discovery) ## 🔗 지식 그래프 (Knowledge Graph) - **상위/루트:** [[C# Tutorial]] - **관련 개념:** [[CSharp Operators Comparison]], [[CSharp Booleans]], [[CSharp Conditions]] - **참조 맥락:** Operators 섹션의 마지막 챕터 — Math 섹션으로 이어짐. ## 📚 출처 (Sources) - [S1] W3Schools — C# Logical Operators — https://www.w3schools.com/cs/cs_operators_logical.php ## 📝 변경 이력 (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "C# Logical Operators" page (Astra wiki-curation, P-Reinforce v3.1 format).