As noted earlier, the executable program that is not a library must always have a function called main (hereinafter the main function). Execution starts from it. It does not matter where the function will be placed: in the source file or in one of the included files. It is important that this function existed and was the only one.

Of course, a programmer can create new functions in addition to main function, with names corresponding to the rules for specifying identifiers, and apply to them both in main function, as well as in the others.

New function is specified starting from function keyword, followed by the name of the function through the separator, and then the list of parameters in parentheses that can be empty. The list of parameters is followed by a function code – a list of its operators in curly brackets.

Syntax for specifying a function:

function function_name(list_of_parameters) {

Example function:

function sum(a, b) {
	c = a + b;

A function in RCML language can either return a value or not return it. Values are returned (similar to exit from function) using return operator. 

It is optional to specify this operator it the end of the function if the value is not returned. If the function does not return the value, then by default the return value is considered to be zero – 0.0.

Function parameter values are always transferred by value, so they can be used as regular variables in a function body without fear of overwriting data in the function where the current one was called from.

The order of the functions with respect to each other is not important and does not affect the scope of their visibility. Each function can be called from any other function, except for the main function. Since execution begins from it, it cannot be called in the code of functions. It is worth noting that a function cannot be declared within the function.

The parameters in the main function (main) have a special meaning, see more in Section "Passing parameters to the RCML program"