Skip to main content

Functions

There are two kinds of functions in Conduct.

Function Statements

Functions are declared using the fn keyword.

fn <name>(<param names>) {
<code>
}

Here is an example:

fn say_hello(name) {
println("Hello, ${name}!")
}

Arrow Functions

Arrow functions are declared using the => operator.

(<param names>) => { <code> }

Here is an example:

const say_hello = (name) => {
println("Hello, ${name}!")
}