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.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.
Primitive Types
Origin provides four primitive types, plusnone for the absence of a value:
| Type | Description | Example Literal |
|---|---|---|
int | Whole number (signed integer) | 10, 0, -4 |
float | Decimal number (64-bit) | 3.14, -0.5 |
str | Text string | "Origin", 'hi' |
bool | Boolean flag | true, false |
none | Null / absence of value | none |
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:
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:
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: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: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:
Tuples
Tuples are immutable ordered sequences declared with parentheses and comma-separated values:(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:| Operator | Meaning | Example |
|---|---|---|
+= | Add and assign | x += 5 |
-= | Subtract and assign | x -= 2 |
*= | Multiply and assign | x *= 3 |
/= | Divide and assign | x /= 4 |
%= | Modulo and assign | x %= 2 |
**= | Power and assign | x **= 2 |
//= | Floor-divide assign | x //= 3 |
&= | Bitwise AND assign | x &= 0xFF |
|= | Bitwise OR assign | x |= 0x01 |
Unary Operators
Origin provides++ (increment) and -- (decrement) as prefix unary operators:
- also works as a unary prefix: