Skip to content

Functional Programming

fn <function_name>(args...) = <function_body>

Example:

fn getSlope(x, y) = 3.0 * x * x + 2.0 * x + y
fn addNums(a, b) = a + b

val results = [
    { Function: "getSlope", Result: getSlope(1, 2) },
    { Function: "addNums", Result: addNums(5, 5) }
]

say.table(results)


Running raven -r example.rn here will output:

(index) Function Result
0 'getSlope' 7
1 'addNums' 10