First program
Write a small file, run it and check its result before introducing custom syntax or application libraries.
Create a source file
Save the following as hello.rl:
const greeting = "Hello, RecurLoop"
var answer = 6 * 7
print greeting
print answer
assert answer == 42Run and verify
recurloop --file hello.rlThe program prints a greeting and 42. A failed assertion reports a problem and causes the run to fail. The embedded standard language is available without a separate bootstrap step.
Introduce a function
let double = fn (value:i64) -> i64 { return value * 2 }
assert double(21) == 42i64 is a signed native integer type. Functions compile to native code and can be called from ordinary expressions.
Find help while reading code
recurloop --docs search "function"
recurloop --docs search "ownership" --jsonSearch finds public language and package documentation. The --json form is useful for tools. Continue through Values, Control flow and Functions, or use the Learning path to see the full sequence.