O Language/API/Types: Difference between revisions
From OnixOS
Created page with "= Types = O Language values are dynamically represented at runtime. {| class="wikitable" ! Value !! Example !! Description |- | Integer || <code>42</code> || Signed whole number. |- | Float || <code>3.14</code> || Floating-point number. |- | Boolean || <code>true</code> || Boolean value. |- | String || <code>"O Language"</code> || Text value. |- | Array || <code>[1, "two", true]</code> || Ordered, zero-based collection. |- | Hash || <code>{"name": "O"}</code> || Key/va..." |
m Protected "O Language/API/Types" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)) |
(No difference)
| |
Latest revision as of 07:32, 25 August 2026
Types
O Language values are dynamically represented at runtime.
| Value | Example | Description |
|---|---|---|
| Integer | 42 |
Signed whole number. |
| Float | 3.14 |
Floating-point number. |
| Boolean | true |
Boolean value. |
| String | "O Language" |
Text value. |
| Array | [1, "two", true] |
Ordered, zero-based collection. |
| Hash | {"name": "O"} |
Key/value collection. |
| Function | fn(x) { return x + 1 } |
Callable value. |
| Empty | Missing or void result | Context-dependent empty result. |
The runtime also exposes system values for processes, environments, sockets, database connections, models, routes, requests, signals, modules, closures, compiled functions, and errors.
Indexing
def items = ["first", "second"]
output(items[0])
def user = {"name": "Ada"}
output(user["name"])
Use type to inspect a runtime type. Use itostr, atostr, and getval for common conversions.
