Functions #
Implicit and explicit return statements are supported.
fibonacci = def (x) {
if (x == 0)
0
else
if (x == 1)
return 1;
else
fibonacci(x - 1) + fibonacci(x - 2);
end
end
};
New in
0.11
:
Functions can now also be created as named functions:
π > def test() { puts("test")}
=> def () {
puts(test)
}
π > test()
"test"