Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/boblio-max/origin/llms.txt

Use this file to discover all available pages before exploring further.

Origin is a strictly-typed language — every variable carries an explicit type annotation that the interpreter tracks and enforces at assignment time. This predictability is intentional: it makes Origin scripts readable at a glance, safe to run on hardware where unexpected values can cause physical damage, and easy for AI tooling to reason about. This page covers how to declare variables and constants, work with Origin’s primitive and collection types, cast between types, and use compound assignment operators.

Primitive Types

Origin provides four primitive types, plus none for the absence of a value:
TypeDescriptionExample Literal
intWhole number (signed integer)10, 0, -4
floatDecimal number (64-bit)3.14, -0.5
strText string"Origin", 'hi'
boolBoolean flagtrue, false
noneNull / absence of valuenone
Boolean literals are lowercase in Origin: true and false. Using True or False (Python-style) will be treated as identifiers, not boolean keywords.

Declaring Variables with let

Use the let keyword to declare a mutable variable. The full syntax is:
let <name>: <type> = <value>
The type annotation follows the variable name, separated by a colon. Here are all five types in action:
let x: int    = 10           # Scalar integer
let name: str = "Origin"     # String literal
let flag: bool = true        # Boolean (lowercase)
let data: none = none        # None / absence of value
Type annotations are strongly encouraged but not strictly enforced by the parser — omitting the : type portion will still parse and run. However, skipping annotations removes the interpreter’s ability to catch type mismatches at assignment time and makes your code harder to maintain.

Defining Constants with const

Use const to declare an immutable binding. Constants are registered internally and cannot be reassigned after declaration:
const pi: float = 3.14159    # Immutable constant
Attempting to reassign a const variable raises a RuntimeError at runtime:
Cannot reassign constant 'pi'
Design your constants carefully — they are fixed for the lifetime of the script.

Type Casting

Origin provides four built-in cast functions that mirror the type names. These are parsed as special keyword expressions, not user-defined functions:
let raw: str   = "42"
let n:   int   = int(raw)       # "42" → 42
let f:   float = float(raw)     # "42" → 42.0
let s:   str   = str(n)         # 42  → "42"
let b:   bool  = bool(n)        # 42  → True
Casting is the correct way to convert between types in Origin. Direct assignment across incompatible types — for example, assigning a str literal to an annotated int variable — will raise a TypeError.

Collection Types

Lists

Lists are ordered, mutable sequences declared with square brackets. Use zero-based integer indices to access elements:
let tools: list = ["Servo", "GPIO", "I2C"]
print tools[0]    # → Servo
You can also update a list element by index:
tools[1] = "PWM"
print tools[1]    # → PWM

Dictionaries

Dictionaries store key-value pairs. Declare them with curly-brace literals {}, and access or update values with the same square-bracket index syntax used for lists:
let config: dict = {"speed": 100, "active": true}
print config["speed"]     # → 100
print config["active"]    # → True
config["speed"] = 200     # update a value

Tuples

Tuples are immutable ordered sequences declared with parentheses and comma-separated values:
let coord: tuple = (10, 20)
Tuples are parsed whenever a parenthesized expression contains a comma, so (10, 20) and (10, 20, 30) are both valid tuple literals.

Compound Assignment Operators

Origin supports the standard set of compound assignment operators for in-place mutation of numeric variables:
OperatorMeaningExample
+=Add and assignx += 5
-=Subtract and assignx -= 2
*=Multiply and assignx *= 3
/=Divide and assignx /= 4
%=Modulo and assignx %= 2
**=Power and assignx **= 2
//=Floor-divide assignx //= 3
&=Bitwise AND assignx &= 0xFF
|=Bitwise OR assignx |= 0x01
let count: int = 0
count += 1      # count is now 1
count *= 10     # count is now 10
count //= 3     # count is now 3

Unary Operators

Origin provides ++ (increment) and -- (decrement) as prefix unary operators:
let i: int = 5
++i    # equivalent to i + 1 → 6
--i    # equivalent to i - 1 → 4
Negation with - also works as a unary prefix:
let neg: int = -10

Build docs developers (and LLMs) love