Global built-ins
Functions available without importing a module.
Almost everything lives in modules. See the Modules section in the sidebar.
vakya(value) converts any Rain value to a string. toString is an alias for the same function. clock() returns process CPU time in seconds.
typeOf(value), isType(value, name), and assertType(value, name) inspect runtime types. See Types & literals for type name strings and examples.
vakya and clock
Stringify any value and read process CPU time.
print vakya(42);
print vakya(3.14);
print toString(true);
print vakya(nil);
print toString(#[1, 2, 3]);
print vakya({"a": 1, "b": 2});
var n = 42;
print "the answer is " + vakya(n);
print clock();Globals
Built-in functions available without `benutzen`.
| Symbol | Description | Example |
|---|---|---|
vakya(value) | Convert any value to a string: numbers, booleans, nil, arrays, maps; strings pass through unchanged | print vakya(42);
print vakya(#["a", "b"]);
print "n=" + vakya(nil); |
toString(value) | Alias for `vakya` | print toString(true); |
clock() | CPU time used by the process, in seconds (float) | print clock(); |
typeOf(value) | Return the runtime type as a string: built-in names like `"number"` and `"array"`, or a class name for instances | print typeOf(42);
print typeOf(#["a"]); |
isType(value, name) | Return `true` if `value` matches the type string `name`; `false` on mismatch or if `name` is not a string | print isType(42, "number");
print isType(42, "string"); |
assertType(value, name) | Return `value` unchanged if the type matches; otherwise raise a runtime `TypeError` | var n = assertType(42, "number");
print n; |
Module index
Standard library modules: each has its own page under Modules.
| Symbol | Description |
|---|---|
importing | User modules, `benutzen`, exports, `::` |
math | Matrices, activations, ML training helpers |
csv | Read CSV into arrays or matrices |
str | String search, slice, split, join, format |
json | parse / stringify / keys |
http | Router, middleware, client, CORS |
db | SQLite connections & queries |
io | Files and stdin |
os | Platform, env, sleep |
time | Dates and formatting |