RCML provides a standard set of structures affecting the progress of the program execution. They can be divided into conditional, cyclic and unconditional.

2.12.1 Conditional Control Structures

RCML has only one conditional transfer operator – if. Its syntax is as follows:

if (expression) {
	//set of operators, if the result of expression is true
} else {
	// set of operators, if the result of expression is false
}

The result of expression in parentheses is reduced to a logical type, and if the result is true, then the first block of operators in curly brackets is executed, otherwise – the second block of operators following else keyword. The second block of operators with else keyword can be omitted when specifying a conditional operator.

2.12.2 Cyclic Control Structures

Cycle (loop) operator in RCML is also unique. It is loop operator. It is a simplified cycle operator in comparison with similar operators in traditional programming languages. It is unconditional, and its block of operators will be executed endlessly, unless it has an appropriate exit structure with prerequisite or without it. The syntax of loop operator is as follows:

loop {
	// set of loop operators
}

2.12.3 Other Control Structures

Other control structures in RCML are operators of unconditional transfer. When reaching them, the program goes to a particular section.

The operator of transfer to the beginning of the cycle – continue. When it is reached, the program goes to the beginning of the current cycle. It is used without parameters.

The operator of loop exit – break. When it is reached, the current loop is interrupted. It is used without parameters.

The operator of function exit – return. It may be used both with an expression, and without it. In the first case the result of the function will be the result returned by the expression. In the second case, the function will return the default value of 0.0.

The syntax of return operator with expression return:

return expression;

Without expression return:

return;

Examples of return operator:

return 2+2; //function exit with expression return
return; // function exit without expression return

If a return operator is specified in the main function, its implementation will lead to termination of the RCML program, and the value passed via this operator will be passed to the OS as the program exit status. However, the passed value will be rounded to integer by dropping the fraction part.

The operator exiting the program – exit. When it is reached, the program stops executiong regardless of function where it is specified. This operator (like return) may be called both with an expression, and without it. In the first case, the result of the expression is returned to the OS as the exit code of the program, in the second case the exit code of the program is considered to be equal to 0.

The syntax of exit operator with expression return:

exit expression;

Without expression return:

exit;