
Example:
example(n)
{
new a = 0
for(new i = 0; i < n; i++)
{
a++
}
return a
}
The "for ( ; ; )" statement is the same as the "while (true)" statement.
13.4.6.11 Goto label
Moves the program control (unconditionally) to the statement that follows the specified label. The label must
be within the same function as the "goto"-statement (a "goto"-statement cannot jump out of a function).
13.4.6.12 If (expression) statement 1 else statement 2
Executes statement 1 if the results of the expression is logical "true". The "else"clause of the "if" statement is
optional. If the result of the expression is logical "false" and there is an "else" clause, the statement that is
associated with the "else" clause (statement 2) is executed.
Example:
example(n)
{
if(n < 0)
return -1
else if (n == 0)
return 0
else
return 1
}
13.4.6.13 Return expression
Terminates the current function and moves the program control to the next statement following the function
call. The expression value is returned as the function result. The expression can be an array or a character
string. The expression is optional, however, if present it must start on the same line as the "return" statement.
Zero is returned if no expression is specified.
13.4.6.14 switch (expression) {case list}
Transfers the sequence control to the various statements within the "switch", depending on the value of the
"switch" expression. The main part of the "switch" statement is a composite statement that comprises a series
of "case" clauses. Each "case" clause starts with the keyword "case" followed by a list of constants and a
statement. The list of constants is a series of expressions separated by commas, each of which is evaluated
as a constant value. This list ends with a colon. To specify an area in this list, separate the lower and upper
limit of the area with a double point (".."). An example for an area is: "case 1..9:".
226
Rev. 05
Содержание myDatalogEASY V3
Страница 2: ......
Страница 13: ...Chapter 2 Declaration of conformity Chapter 2 Declaration of conformity Rev 05 13 ...
Страница 14: ......
Страница 42: ......
Страница 76: ......
Страница 88: ......
Страница 102: ......
Страница 110: ......
Страница 116: ......
Страница 234: ......
Страница 244: ......
Страница 252: ......
Страница 254: ......
Страница 266: ......
Страница 276: ......