Script Operators


In this tutorial you will learn:

  • about the different types of operators
  • compute some values with mathematical expression
  • compare values with logic and relational operators

Operators in flowScript

The following Table shows an excerpt from the one that can be found in the Usermanual

Type Operator Example can operate on
... ... ... ...
add + a + b Integer, Real, String
substract - a - b Integer, Real
multiply * a * b Integer, Real
divide / a / b Integer, Real
power ^ a ^ b Integer, Real
negate - -a Integer, Real
equal equal a equal b Integer, Real
not equal notEqual a notEqual b Integer, Real
greater greater a greater b Integer, Real
greater or equal greaterOrEqual a greaterOrEqual b Integer, Real
less less a less b Integer, Real
less or equal lessOrEqual a lessOrEqual b Integer, Real
and and a and b Boolean, Integer, Object
or or a or b Boolean, Integer, Object
xor xor a xor b Boolean, Integer, Object
not not not a Boolean, Integer, Object
... ... ... ...

Some of the operators will be used next.

Evaluation of Mathematical Expression

In flowScript it is possible to specify mathematical expression that will be evaluated during script execution.

Please start FlowModeler and open the Script-IDE.

Next we will specify some mathematical expressiond and print their result. For example:

print( 10 + 20 + 30 - 5 )
print( 2.5 * 10 )
print( 2^3 )

Operations can be gouped so that a certain part is evaluated before another part of an expression

print( 2 * 1 + 5 )
print( 2 * (1 + 5) )

Evaluation of Relational Expressions

With relational operators two values can be compared to each other. The operation returns either true or false. For example:

print( 10 greater 9 )
print( 0 lessOrEqual 5 )
print( 1.2 equal 1.3 )
print( 1.2 notEqual 1.3 )

Evaluation of Logic Expressions

Logic operators can be used to evaluate the logic value of boolean expression like and, or, not and xor. For example:

print( 1 and 0 )
print( 1 and 1 )
print( (10 greater 9) or (1.2 notEqual 1.3) )


The above examples are only a very brief overview of the available operators. For the full list please refer to the Operators table in the Usermanual.