BER Programming Language - Functions

Functions let you group reusable code and run it whenever you want.

Defining a Function

function greet()
  board:("Hello, world!")
end

This defines a function named greet that prints "Hello, world!".

Calling a Function

greet

To run the function, just write its name.

Functions with Parameters

function greet.name(name)
  board:(name)
end

greet.name:("Bernardo")

This function prints the name passed to it.

Tip: Always close functions with end. Function calls don’t need parentheses unless passing parameters.