> ## 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.

# Dart Logical OR

The `||` (logical OR) operator is a binary boolean operator that evaluates two expressions and returns `true` if at least one of the operands evaluates to `true`. It returns `false` strictly when both operands evaluate to `false`.

```dart theme={"dark"}
expression1 || expression2
```

## Technical Characteristics

* **Strict Type Requirement:** Both operands must evaluate to the `bool` type. Unlike languages with "truthy" or "falsy" concepts (e.g., JavaScript), Dart enforces strict type checking and does not perform implicit type coercion on non-boolean values.
* **Short-Circuit Evaluation:** Dart evaluates the `||` operator using short-circuit logic from left to right. If the left operand evaluates to `true`, the operator immediately yields `true` and the right operand is **never evaluated**.
* **Associativity:** Left-to-right.
* **Precedence:** The `||` operator has lower precedence than the logical AND (`&&`) operator and relational operators (such as `==`, `!=`, `<`), but higher precedence than assignment operators (`=`).

## Evaluation Mechanics

The following demonstrates the standard truth table outcomes:

```dart theme={"dark"}
bool a = true || true;   // true
bool b = true || false;  // true
bool c = false || true;  // true
bool d = false || false; // false
```

## Short-Circuit Behavior

Because of short-circuit evaluation, the right-hand expression is entirely bypassed if the left-hand expression satisfies the `true` condition. This mechanism prevents the execution of functions, state mutations, or potential runtime errors present in the second operand.

```dart theme={"dark"}
bool executeSideEffect() {
  print('Right operand evaluated');
  return true;
}

void main() {
  // The left operand is true, so short-circuiting occurs.
  // executeSideEffect() is never called, and nothing is printed.
  bool result1 = true || executeSideEffect(); 

  // The left operand is false, so the right operand MUST be evaluated.
  // "Right operand evaluated" is printed to the console.
  bool result2 = false || executeSideEffect(); 
}
```

## Strict Boolean Enforcement

Attempting to use non-boolean types with the `||` operator results in a compile-time error. Expressions must be explicitly resolved to `bool`.

```dart theme={"dark"}
// INVALID: Compile-time error
// Error: A value of type 'int' can't be assigned to a variable of type 'bool'.
bool invalid = 1 || 0; 
bool invalidString = "text" || "";

// VALID: Explicit boolean expressions are required
bool valid = (1 > 0) || ("text".isNotEmpty); 
```

<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 Dart 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>
