Expressions in the itemis CREATE statechart language are similar to expressions in other programming languages. The language provides operators for logical expressions, number arithmetic, bitwise arithmetic, and bit shifting.
The type of a logical expression is boolean.
expr1 && expr2
expr1 || expr2
!expr1
expr1 ? expr2 : expr3
If
expr1
evaluates to true, this returns
expr2
, else
exp3
. This can be used to assign values to variables:
y = x > 5 ? 1 : 2
This does the same as the following snippet of C code:
if(x > 5) {
y = 1;
} else {
y = 2;
}
expr1 ^ expr2
expr1 | expr2
expr1 & expr2
less than |
<
|
equal or less than |
<=
|
greater than |
>
|
equal or greater than |
>=
|
equal |
==
|
not equal |
!=
|
shift left |
<<
|
shift right |
>>
|
plus |
+
|
minus |
-
|
multiply |
*
|
divide |
/
|
modulo |
%
|
positive |
+
|
negative |
-
|
complement |
~
|