Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
The syntax of standard control structures:
-
if boolean-expr then stmts else stmts endif if boolean-expr then stmts else if boolean-expr then : disambiguated by indentation stmts endif foreach var in set-or-sequence-expr stmts endfor for var := first-value to last-value stmts endfor while boolean-expr stmts endwhile return expr raise expr
The keyword raise is used to raise an RPC exception. The operand of the raise expression specifies the RPC exception to be raised. Details of how an RPC exception is raised are specified in [C706] section 12.6.4.7.
Other constructs used (inspired by Modula-3; for more information, see [NELSON]):
-
: declare a procedure : with typed args and result procedure name(arg: type, arg: type, ... , arg: type): type : declare a procedure : with call-by-reference args procedure name(var arg: type, ... , var arg: type): type : cast a variable or an expression value : to a different type loophole(expr, type) var: type : declare a variable with a type var := expr : assignment expr^ : pointer dereferencing expr.id : field selection
List of infix and prefix operator binding precedence (strongest binding at the top of the list):
-
x.a : infix dot f(x) a[i] : applicative (, [ p^ : postfix ^ + - : prefix arithmetics * / mod ∩ : infix arithmetics; set intersection + - : infix arithmetics; set union and difference = ≠ < ≤ ≥ > in : infix relations not : prefix not and : infix and or : infix or
All infix operators are left-associative, and so, for example:
-
a - b + c
means:
-
(a - b) + c
Parentheses can be used to override the precedence rules.
The infix Boolean operators "and" and "or" are evaluated left to right, conditionally. The expression "p and q" is true if both p and q are true. If p is false, q is not evaluated. The expression "p or q" is true if at least one of p and q are true. If p is true, q is not evaluated.