13.4.5 Operators and expressions
13.4.5.1 Notational conventions
The use of some operators is dependent on the relevant type of operand. The following notations are
therefore used in this chapter:
e
Any expression
v
Any expression that can be assigned a value ("lvalue" expression - variable)
a
An array
f
A function
s
A symbol - this can be a variable, a constant or a function
13.4.5.2 Expressions
An expression consists of one or several operands with an operator. The operand can be a variable, a
constant or another expression. An expression followed by a semicolon is a statement.
Examples of expressions:
v++ f(a1, a2)
v = (ia1 * ia2) / ia3
13.4.5.3 Arithmetic
Operator Example
Explanation
+
e1 + e2
Result of adding e1 and e2
-
e1 - e2
Result of subtracting e2 from e1
-e
Result of the arithmetic negation of e (two's complement)
*
e1 * e2
Result of multiplying e1 with e2
/
e1 / e2
Result of dividing e1 by e2. The result is truncated to the closest whole number that is
less or equal to the quotient. Positive and negative values are rounded down (negative
infinity).
%
e1 % e2
Result is the remainder of the division of e1 by e2. The prefix is the same as that of e2
++
v++
Increases v by 1. The result of the expression is the value before the increase.
++v
Increases v by 1. The result of the expression is the value following the increase.
--
v--
Decreases v by 1. The result of the expression is the value before the decrease.
--v
Decreases v by 1. The result of the expression is the value following the decrease.
Note:
The unary + is not defined in the pawn. The ope+ and -- change the operand. The
operand must be a "lvalue".
218
Rev. 05
Summary of Contents for myDatalogEASY V3
Page 2: ......
Page 13: ...Chapter 2 Declaration of conformity Chapter 2 Declaration of conformity Rev 05 13 ...
Page 14: ......
Page 42: ......
Page 76: ......
Page 88: ......
Page 102: ......
Page 110: ......
Page 116: ......
Page 234: ......
Page 244: ......
Page 252: ......
Page 254: ......
Page 266: ......
Page 276: ......