Klik op het logo voor hulp op afstand
  
 
 
 
 
 
 
 




Expressions


Evaluation rules :

  • Unary operators and assignments are evaluated from right to left.
  • Binary operators are evaluated according to their priority and from left to right.

Binary operators in ascending order
|| ^^
Lowest priority
&&
 
=  !=  <> > >=  <  <=
 
+ - | ^
 
* / // \ \\ &
 
**
Highest priority

Logical expressions are evaluated completely, no lazy (or short-circuit) evaluation is used !
 

 
Expression examples:

a := 10
Expression is a simple assignment, a is assigned the value 10.
a := b := c := 10
a, b and c are assigned the value 10. The variable c is assigned first, b second and the variable a last.
a+1 < 10
The priority of the + operator exceeds the priority of the < operator thus the sub-expression a+1 is evaluated first.
If the variable a has a value equal to or greather than 9 before the expression is evaluated the result of the expression will be FALSE.
1+2*3
The priority of the * operator exceeds the priority of the + operator thus the result will be 7.
(1+2)*3
The sub-expression between the parentheses is evaluated first so that the result will be 9.
FALSE && (a:=a+1)
The value of the variable a is incremented although the first sub-expression is FALSE. No lazy evaluation is applied as it is used in some other languages. (e.g. Pascal)
a=0 && b>10 || a!=0 && b<-10
 
is similar to
 
((a = 0) && (b > 10)) || ((a != 0) && (b < -10))
 
a := -b := 1
 
is invalid and should be
 
a := -(b := 1)
The first expression is not allowed! The assignment operator := cannot assign a value to an expression.
!(a && b) is similar to !a || !b
 

 

Back to Scripting the Language




 |  History  |
 
 

 
 
 
TECHWIN SOFTWARE
De Regenboog 11
B-2800 Mechelen
T +32(0)15 44 64 64
T +31(0)30 899 32 15 Nederland