Documentation
How Rain actually works: syntax, modules, stdlib. Written against the rainc tree, not aspirational features.
Get started
- Install RainDownload a pre-built binary for macOS or Linux, or build from source if you have repo access.
- Hello WorldYour first Rain program: save a file and run it.
- Build from sourceCompile Rain locally when you have the rainc repository.
Basics
- VariablesDeclare mutable bindings with `var`.
- Types & literalsDynamic typing: numbers, strings, booleans, arrays, maps, and `nil`.
- StringsLiterals, interpolation, escaping, and concatenation.
- OperatorsArithmetic, comparison, logic, and assignment.
- PrintShow output with `print`.
- CommentsLine comments with `//`.
- ArraysLiteral arrays, indexing, and methods.
- MatrixDefine dense numeric matrices with the math module.
- MapsString-keyed hash maps with `{ }` literals and bracket access.
Control flow
- If / elseBranch on conditions: parentheses required.
- While loopsRepeat while a condition is true.
- For loopsC-style `for (init; condition; increment)`, `for (item von array)`, and `for (key, value von map)`.
- Break / continueExit a loop early or skip to the next iteration.
- Versuch / fang (try/catch)Catch runtime errors with `versuch { } fang (err) { }`: the Rain equivalent of try/catch.
Functions
- FunctionsDefine reusable code with `fun`.
- Anonymous functionsInline `fun(params) { ... }` expressions: no name required.
- Variadic functionsAccept any number of trailing arguments with `...param`.
- ClosuresFunctions capture variables from surrounding scopes.
Classes
- ClassesObjects with methods, fields, and constructors.
- InheritanceExtend classes with `<` and call superclass methods with `super`.
- Optional chainingSafely read nested instance fields when a link in the chain might be `nil`.
Modules
- ModulesLoad built-ins and your own `.rn` files with `benutzen`. Every top-level binding is exported: no export keyword.
- mathScalars, array math, matrices, activations, and neural-network helpers.
- csvRead CSV files into arrays or matrices: built for MNIST-scale training pipelines.
- strString search, slice, split, join, format, and parsing.
- jsonParse and stringify JSON.
- httpHTTP server, routing, middleware, client, and CORS.
- dbSQLite: open, exec, query with parameters.
- ioRead, write, append files; read stdin.
- osPlatform info, environment, sleep, exit.
- timeCurrent date, time parts, formatting.
Reference
- Keywords & syntaxQuick cheat sheet for Rain syntax.
- Global built-insFunctions available without importing a module.