Rune Examples

Code Examples

Here are some examples of what you can do with Rune:


# Hello World
main = fun() {
    print("Hello, World!")
}

# Factorial
factorial = fun(n) {
    if n == 0 then return = 1
    n * factorial(n - 1)
}
println(factorial(5)) # Outputs 120

# Fibonacci
fibonacci = fun(n) {
    if n <= 1 then return = n
    fibonacci(n - 1) + fibonacci(n - 2)
}
print(fibonacci(10)) # output 55