Function Parameters
BER functions can accept parameters. Here’s how you do it:
function add(a, b)
board:(a + b)
end
add(5, 10)
Simulated Return Values
BER doesn’t have return statements, but you can simulate returning by using variables or outputting values:
function get.name()
board:("Bernardo")
end
get.name()
Nested Functions
You can define functions inside functions to organize code:
function outer()
function inner()
board:("Inside inner!")
end
inner()
end
outer()
Function Names with Dots
You can name functions like object.method()
, to simulate methods:
function project.build()
board:("Building project...")
end
project.build()
Tips
- Always close functions with
end
- Call functions with parentheses
()
- Undefined function calls show errors (red)
- Correct function calls highlight in yellow