previous contents index next
(..Operators..) Contents Index (Functions..)

2.7.5 Operator Hierarchy

In this paragraph, all operators already known together with the assign operators (=, +=, -=, ..., ++, -) as well as [ ] and ., which will be discussed later, are listed in a table.
To avoid confusions we already mention at this point that the brackets used as operators [ ] are intended to get a character at a certain position of a string. (Brackets are also used to mark cell positions; but then they do not function as operators.)

By the selection operator . single registers of cell expressions are accessed.


 

The operators are listed in rows by descending evaluation order. Besides, for operators with the same priority it is indicated whether they are evaluated from the left to the right (L) or the other way around (R).

Concerning evaluation order and direction SCARLET totally agrees with the programming language C.

Operators Direction
( ), [ ], . L
++, -, !, + ( Sign), - ( Sign) R
*, /, % L
+, - L
<<, >> L
<, <=, >, >= L
==, != L
& L
| L
&& L
|| L
=, +=, -=, *=, %=, /=, <<=, >>=, &=, |= R


Fig. 7: Operator Table
 


Example 14:

Sometimes it becomes necessary to use parentheses to obtain evaluation priority:

 !TRUE || TRUE                          leadsto  TRUE
 !(TRUE || TRUE)                        leadsto  FALSE
 1000 < 1024 && !("today"=="tomorrow")  leadsto  TRUE
 16 >> 1 == 2 << 2                      leadsto  TRUE

previous contents index next
(..Operators..) Contents Index (Functions..)