User's Manual

Elatec GmbH
Page 25 of 44
7.1.6.2 if else Statement
An if else statement has the form:
if (expression) statement1 else statement2
Statement1 is executed only, if the result of expression is not equal to zero. Otherwise, statement2 is
executed.
7.1.6.3 while Statement
A while statement has the form:
while (expression) statement
Statement is executed, as long as the result of expression is not equal to zero.
7.1.6.4 do while Statement
A do while statement has the form:
do statement while (expression);
Statement is executed, until the result of expression is equal to zero.
7.1.6.5 for Statement
A for statement has the form:
for ([expression1]; [expression2]; [expression3] statement
As first step, expression1 is evaluated. As long as expression2 is not equal to zero, statement is
executed. After execution of statement, expression3 is evaluated. Therefore, a for statement can be
rewritten as while statement with exactly the same behavior:
expression1;
while (expression2)
{
statement
expression3;
}
7.1.6.6 switch Statement
A switch statement has the form:
switch (expression)
{
[case constant expression: [case statement]]
[default: [default statement]]
}
The script is evaluating expression. Depending on the result of the expression the appropriate case is
executed. If there is no appropriate case, the default case is executed. If there is no default label,
execution is continued after the switch statement.