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

# Go bool

The `bool` type in Go is a predeclared, strictly typed primitive representing a boolean truth value. It is restricted to exactly one of two universe block identifiers: `true` or `false`.

## Memory and Architecture

A `bool` in Go occupies exactly 1 byte (8 bits) of memory, regardless of the underlying system architecture (32-bit or 64-bit).

## Zero Value

The zero value for an uninitialized `bool` is `false`.

```go theme={"dark"}
var b bool
// b is strictly evaluated as false
```

## Strict Type Safety

Go enforces strict type boundaries for booleans. Unlike C or Python, Go does not treat numeric values (like `0` or `1`) or nil pointers as truthy or falsy. A `bool` cannot be implicitly or explicitly converted to or from any numeric type.

```go theme={"dark"}
var b bool = true

// INVALID: Cannot convert bool to int
// var i int = int(b) 

// INVALID: Cannot evaluate integer as boolean
// if 1 { ... } 
```

## Operators and Evaluation

The `bool` type supports logical and equality operators. Go employs **short-circuit evaluation** for logical operators, meaning the right-hand operand is only evaluated if the left-hand operand does not definitively determine the overall expression's result.

* **Logical AND (`&&`):** Yields `true` if both operands are `true`. Short-circuits if the left operand is `false`.
* **Logical OR (`||`):** Yields `true` if either operand is `true`. Short-circuits if the left operand is `true`.
* **Logical NOT (`!`):** Unary operator that negates the boolean value.
* **Equality (`==`, `!=`):** Compares two boolean values.

```go theme={"dark"}
var x bool = true
var y bool = false

resAnd := x && y // false
resOr  := x || y // true
resNot := !x     // false
resEq  := x == y // false
```

## String Formatting

When interacting with the `fmt` package, the specific format verb for a `bool` is `%t`.

```go theme={"dark"}
package main

import "fmt"

func main() {
    var isActive bool = true
    fmt.Printf("Status: %t\n", isActive) // Output: Status: true
}
```

## Type Definition

When creating a new defined type based on `bool`, the new type inherits the memory footprint and boolean characteristics but becomes a distinct type. It loses implicit type compatibility with the predeclared `bool` and requires explicit conversion. This differs from a true type alias (`type FeatureFlag = bool`), which would remain completely interchangeable.

```go theme={"dark"}
type FeatureFlag bool // Type definition, creating a distinct type

var isEnabled FeatureFlag = true
var rawBool bool = false

// INVALID: Mismatched types FeatureFlag and bool
// rawBool = isEnabled 

// VALID: Explicit conversion
rawBool = bool(isEnabled)
```

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