> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Kotlin Logical OR

The `||` operator in Kotlin performs a logical disjunction (OR) between two `Boolean` expressions. It evaluates to `true` if at least one of the operands is `true`, and `false` strictly when both operands are `false`.

```kotlin theme={"dark"}
val result = expression1 || expression2
```

## Technical Characteristics

**1. Short-Circuit Evaluation**
Kotlin implements lazy evaluation for the `||` operator. The compiler evaluates the left-hand side (LHS) expression first. If the LHS evaluates to `true`, the overall expression is guaranteed to be `true`, and the right-hand side (RHS) expression is **never evaluated**. The RHS is only evaluated if the LHS evaluates to `false`.

**2. Type Constraints**
Both operands must resolve to the `Boolean` type. Kotlin does not support implicit truthiness (e.g., evaluating integers or null references as booleans).

**3. Operator Precedence**
The `||` operator has lower precedence than the logical AND operator (`&&`) and equality operators (`==`, `!=`), but higher precedence than assignment operators (`=`, `+=`).

**4. Non-Overloadable**
Unlike arithmetic operators or the bitwise `or` infix function, the `||` operator cannot be overloaded via operator overloading. This restriction exists because short-circuiting is a compiler-level control flow mechanism, not a standard function call.

## Truth Table and Evaluation Path

| Left Operand (`LHS`) | Right Operand (`RHS`) | Evaluation Path | Result  |
| :------------------- | :-------------------- | :-------------- | :------ |
| `true`               | *Ignored*             | `LHS` only      | `true`  |
| `false`              | `true`                | `LHS` → `RHS`   | `true`  |
| `false`              | `false`               | `LHS` → `RHS`   | `false` |

## Syntax Visualization

The following code demonstrates the short-circuiting mechanics using side-effecting functions to visualize execution flow:

```kotlin theme={"dark"}
fun returnTrueWithLog(): Boolean {
    println("Evaluated RHS")
    return true
}

// LHS is true. RHS is skipped. 
// Output: (No print statement executed)
val a = true || returnTrueWithLog() 

// LHS is false. RHS must be evaluated.
// Output: "Evaluated RHS"
val b = false || returnTrueWithLog()

// Precedence demonstration: && evaluates before ||
// Equivalent to: true || (false && false)
val c = true || false && false 
```

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Kotlin Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
