Otter Snippets Otter Upstream Otter 1.0.1 Tested

Numeric Range Boundary Assertion

Assert that a numeric parameter falls within inclusive lower and upper bounds.

ID: snippet/val-numeric-range Version: 1.0.0 License: MIT Framework: Otter 1.0.1

Architecture & Runtime Preview

Otter 1.0.1

Zero-dependency Otter 1.0.1 snippet (Validation & Errors). Copy the parameterized template or run the self-contained example.

  1. 1Category: Validation & Errors
  2. 2Attribution: Otter Reusable Library (Official)
  3. 3Zero external pack dependencies — paste directly into any .ot file

Source Code (2 files)

template.ot · otter
to validateRange value minVal maxVal fieldName
    if value is less than minVal
        say "Validation error:" fieldName "is below minimum" minVal
        return false
    .
    if value is greater than maxVal
        say "Validation error:" fieldName "exceeds maximum" maxVal
        return false
    .
    return true
.

Installation & Usage

otter snippet inspect val-numeric-range

Copy template.ot directly into your .ot source file, or run example.ot with 'otter run example.ot'.