Documentation index Main site
Bendyroad IDE reference manual. © Copyright Bendyroad 2024.

Rules reference

The decision logic is specified in multiple rules.

Rule

A rule consists of a list of one or more statements.

Statement

A statement always ends with a ';' semi-colon. Multiple statements can be combined.

Example:

<statement> ; <statement> ;

or:

<statement> ;
<statement> ;

There are 2 kinds of statements:

The 'if' statement

An "if" statement can have the following forms ;

if( <expression> ) { <statements> } else { <statements> };

if( <expression> ) { <statements> } ;

The else part is optional.

If the expression evaluates to non-zero the first statements will be executed.

If the expression evaluates to zero the next list of statements will be executed. The 'else' part of the if statement.

For example:

if( temp > 10 ) {
    fan = 1 ;
} else {
    fan = 0 ;
}

Expression

An expression can be a single item or a combination of expressions.

Constants, for example:

10
12345

Variables, for example:

temp
fan

Operator expressions are formed as:

<expression> <operator> <expression>

For example, arithmetic expressions:

a + z
b / c
d * e
f - g

Boolean expressions:

a < 10
b < c
c > d
e == f
e <= f
e >= f

Assignment

A assignment consists of a left part and a right part combined with an '=' (equal) sign. The left part should always be a variable reference. The right part is an expression.

<variable> = <expression> ;

For example:

temp = temp2 - 10 ;