Control structures allows to modify the execution chain. As well, control functions can also be used.
Control structures have always a name and a body. The body will be specified with curly braces
like { oder }.
| Control structure | Syntax | |
|---|---|---|
|
IF |
Allows to branch the expression with a condition. Similar to this control structure the
control function IIF can also be used.
Example: if(5>4) { ... }
|
IF( boolean Condition )
Condition: The condition which musst be fulfilled to execute the body. |
|
ELSE |
The else structure can be followed by an if and allows to specify the
body which will be executed if the if condition results false.
Example: if(5<4) { ... } else { ... }
|
ELSE |
|
WHILE |
Loops the body so long since the loop condition returns true and aborts
if the result is false.
Example: while($i<10) { $i++ }
|
WHILE( boolean Condition )
Condition: The condition which musst be fulfilled to execute the body. |
|
FOR |
Loops the body so long since the loop condition returns true and aborts
if the result is false. Different to the WHILE loop, there is an initial and a counting parameter which can be specified.
Example: for($i<-0; $i<10; $i++) { ... }
|
FOR(variant Init; boolean Condition; variant Loop)
Init: This parameter is to be executed befor the loop starts. Condition: The condition which musst be fulfilled to execute the body. Loop: This parameter is always be executed if the loop body is entered (but not the first time). |