O Language/API/Types

From OnixOS
Revision as of 07:32, 25 August 2026 by Tedaryum (talk | contribs) (Protected "O Language/API/Types" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite)))
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.