> ## 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 Less Than Or Equal To

The `<=` (less than or equal to) operator is a binary relational operator that evaluates whether the left operand is strictly less than or mathematically equal to the right operand. It yields an untyped boolean value (`true` or `false`).

```go theme={"dark"}
result := operand1 <= operand2
```

## Type Constraints and Assignability

In Go, the `<=` operator requires the operands to be of the same type, or one operand must be implicitly assignable to the type of the other. When comparing a typed variable with an untyped constant, the constant must be representable by a value of the variable's type. For example, comparing an `int` variable to the untyped constant `5.0` is valid because `5.0` is representable as an integer, but comparing it to `5.5` will result in a compile-time error.

Furthermore, the operands must belong to an **ordered type**. Ordered types in Go consist of:

* **Integer types:** `int`, `int8`, `int16`, `int32`, `int64`, `uint`, `uint8`, `uint16`, `uint32`, `uint64`, `uintptr`, `byte`, and `rune`.
* **Floating-point types:** `float32` and `float64`.
* **String types:** `string`.
* **User-defined types:** Any custom type whose underlying type is one of the ordered types listed above (e.g., `type CustomInt int`).

Attempting to use `<=` with unordered types—such as booleans, complex numbers (`complex64`, `complex128`), pointers, channels, interfaces, or composite types (structs, arrays, maps, slices)—will result in a compile-time error.

## Evaluation Mechanics

**Numeric Evaluation**
For integers and floating-point numbers, the operator evaluates standard mathematical ordering. Floating-point comparisons adhere to IEEE-754 specifications:

* `-0.0 <= +0.0` evaluates to `true`.
* If either operand is `NaN` (Not a Number), the result is always `false`.

**String Evaluation**
Strings are evaluated lexicographically, byte-by-byte. The operator compares the raw byte values of the UTF-8 encoded strings. If the bytes at a given index are identical, it proceeds to the next byte. A shorter string is considered less than a longer string if all bytes up to the length of the shorter string are equal.

## Syntax Visualization

```go theme={"dark"}
// Integer evaluation
var x, y int = 10, 10
isLessOrEq := x <= y // true

// Floating-point evaluation with IEEE-754 rules
var f1, f2 float64 = 3.14, 5.0
floatRes := f1 <= f2 // true

// String evaluation (lexicographical byte comparison)
s1, s2 := "apple", "banana"
strRes := s1 <= s2 // true (byte value of 'a' is less than 'b')

// User-defined ordered type evaluation
type CustomInt int
var c1, c2 CustomInt = 4, 7
customRes := c1 <= c2 // true

// Untyped constant representability
var a int = 5
validConstRes := a <= 5.0 // true (5.0 is representable as an int)
// invalidConstRes := a <= 5.5 // compile-time error: constant 5.5 truncated to integer

// Invalid: Type mismatch (Compile-time error)
// var b float64 = 5.0
// errRes := a <= b // compile-time error: mismatched types int and float64
```

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