Functions
Functions are used to group a block of code that can be executed multiple times. They are declared using the fun
keyword.
fun foo(){ // code block}
Parameters
Functions can take arguments. These are the values that are passed to the function when it is called:
fun add(a, b){ // code block}
Return
Functions can return a value using the return
keyword:
fun add(a, b){ return a + b;}