Variables & Values
Lumen is dynamically typed. A variable comes into existence the first time you assign to it — there’s no separate declaration syntax.
number = 42
result = number + 10
println result
Value types
Under the hood, every value carried on the stack or stored in a variable is tagged with one of three types:
| Type | Description |
|---|---|
| Integer | Whole numbers, stored as 64-bit integers |
| Float | Floating-point numbers, stored as double |
| String | Text, delimited with single quotes |
You never annotate the type yourself — it’s inferred from the literal or the result of an expression, and it can change across the lifetime of a variable, since Lumen re-tags the value on every assignment.
x = 5 # integer
x = 'five' # now a string — perfectly legal
Assignment
Assignment is a single =. The right-hand side can be a literal, another variable, or an arithmetic expression:
a = 10
b = a * 2
c = a + b - 1
Negative numbers work as you’d expect:
z = -20