On this page
O Language represents values dynamically at runtime. The common source values are:
| Value | Example | Notes |
|---|---|---|
| Integer | 42 |
Whole number. |
| Float | float 3.14 |
Written with the float form in this parser revision. |
| Boolean | true |
The literals are true and false. |
| String | “O Language” |
Text; string concatenation uses +. |
| Array | [“Core”, “KDE”] |
Ordered collection with zero-based indexes. |
| Hash | {“name”: “OnixOS”} |
Key/value collection, read with square brackets. |
| Function | fn(x) { return x } |
Callable value that can be stored or passed to another function. |
The interpreter also returns runtime objects for processes, environment values, sockets, database connections, models, routes, servers, modules, errors and closures.
NULL and EMPTY
NULL represents a null value, including a missing hash key or an array index outside its range. EMPTY is used by functions and statements with no ordinary value to return. They are distinct runtime types.
Use type(value) to inspect the runtime type label. The detailed object definitions are in object/object.go in the runtime source.
Index values
def profiles = ["Core", "KDE"]
output(profiles[0])
def edition = {"name": "OnixOS"}
output(edition["name"])
The interpreter accepts string, integer and boolean hash keys. Array indexes are integers. Use the syntax and conversion functions in the built-in reference rather than relying on implicit type conversions.
Execution path matters
The interpreter, bytecode VM and ELF output path support different object and expression sets. A value accepted by the interpreter may still be unsupported by a compiler backend. See Execution paths and compatibility before changing the execution command.