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

The `+` operator in Go is an overloaded operator that functions as a binary arithmetic operator for numeric addition, a binary operator for string concatenation, and a unary operator for numeric identity. Due to Go's strict type system, binary operations require both operands to resolve to the identical type; Go does not perform implicit type coercion.

```go theme={"dark"}
// Unary syntax
+operand

// Binary syntax
operand1 + operand2
```

## Binary Numeric Addition

When applied to numeric types (integers, floating-point numbers, and complex numbers), the `+` operator computes the mathematical sum of the two operands.

* **Type Strictness:** Both operands must be of the exact same type (e.g., `int32` + `int32`). Attempting to add an `int32` to an `int64` results in a compile-time type mismatch error. Explicit type conversion is required to align the operand types prior to evaluation.
* **Integer Overflow:** Go handles integer overflow silently. If the sum of two integers exceeds the maximum representable value for their bit-width, the result wraps around according to two's complement arithmetic (for signed integers) or standard modulo arithmetic (for unsigned integers). It does not trigger a runtime panic.
* **Floating-Point and Complex:** Addition follows IEEE-754 standards, including the handling of infinities and `NaN` (Not a Number) values.

```go theme={"dark"}
var a int8 = 127
var b int8 = 1
var c int8 = a + b // c is -128 (silent overflow)

var x float32 = 1.5
var y float64 = 2.0
// var z = x + y   // Compilation error: mismatched types
var z = float64(x) + y // Valid explicit conversion
```

## Binary String Concatenation

When applied to operands of type `string`, the `+` operator performs byte-wise concatenation.

* **Immutability:** Because strings in Go are immutable, the `+` operator allocates a new backing array in memory and copies the byte sequences of the left operand followed by the right operand into this new array.
* **Type Strictness:** Both operands must be strings. Go will not implicitly convert a numeric or boolean type to a string during concatenation.

```go theme={"dark"}
str1 := "foo"
str2 := "bar"
result := str1 + str2 // Yields a new string "foobar"
```

## Unary Identity

When used as a prefix to a single numeric operand, `+` acts as the unary identity operator. It yields the unmodified value of the operand. It cannot be applied to strings or booleans.

```go theme={"dark"}
var a int = 5
var b int = +a // b is 5
```

## Untyped Constants

If the operands are untyped constants, the `+` operator is evaluated at compile-time rather than runtime. Go's compiler performs constant arithmetic with arbitrary precision (at least 256 bits). The result of adding two untyped constants is a new untyped constant, which only assumes a concrete type when assigned to a variable or used in a typed context.

```go theme={"dark"}
const a = 1e100
const b = 2e100
const c = a + b // Evaluated at compile-time, no overflow
```

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