Statements

Statements in Reflex include control structures, assignment statements, and routine and reflex execution statements. A reflex or routine is made of a series of statements. In addition, a variable_declaration is a special type of statement which must preceed other types of statements within a statement list.

Control Statements

The largest class of statements are the control statements. These include branching statements like If-else and switch statements and looping control statements with include for and while loops. The reflex language syntax for control statements follows the familiar C-Like pattern. However the lack of sub scoping and the fact that variables are defined before other statments means that care must be given when introducing control statments which use variables.

There is only one variable scope within the reflex language and that is the routine/reflex scope. compound statements that are part of a loop or if statement do not introduce new scope, and declared variables are visible and available throughout the routine.

Control statments include:

Control Statements

If/Else

Branching

Switch

Branching

While

Looping

For

Looping

Do while

Looping

If/Else

If/Else statements follow the C syntax. For example;

if ( a == b ) {
    ...
} else {
    ...
}

Switch

Switch statements follow the C syntax. For example;

switch ( a ) {
    case 1:
        ...
    break;

    case 2:
        ...
    break;

    default:
        ...
    break;
}

While

While statements follow the C syntax. For example;

while ( a != b ) {
    ...
}

For

For statements follow the C syntax. However the iteration variable must be declared with The rest of the variable declarations at the beginning of the reflex or routine compound statement. For example;

reflex mapEnable() {
    int i;
    for ( i = k; i > 0; i-- ) {
        ...
    }

Do While

Do while statements follow the C syntax. For example;

do {
    ...
} while (a != b);