
The "switch" statement shifts the sequence control to a "case" clause if a value from the list corresponds to the
value of the "switch" expression.
The "default" clause consists of the "default" keyword and a double point. The "default" clause is optional,
however, if it is specified it must be included as the last entry in the "case" list. The "switch" statement shifts
the sequence control to the "default" clause if none of the "case" clauses comply with the "switch" expression.
Example:
example(n)
{
new a = 0
switch (n)
{
case 0..3:
a = 0
case 4,6,8,10:
a = 1
case 5,7:
a = 2
case 9:
a = 3
default:
a = -1
}
return a
}
12.5.6.15 While (expression) statement
Evaluates the expression and executes the statement if the result of the expression is logical "true". The
program control returns to the expression again once the statement has been executed. The statement is
therefore executed as long as the expression is logical "true".
Example:
example(n)
{
new a = 0
while(n >= 0)
{
a++
}
return a
}
178
Rev. 01