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
|
|