beautypg.com

Precedence & order of evaluation – Xerox -05W User Manual

Page 221

background image

12-17

Creating A Script File

For example:

var $String
while (String != "Exit")
inp "Give me a string", String
exit

would keep requesting for input until the string equals Exit.

The < and <= operators compare the decimal values of each character in the string in
turn to see if the values are less than that of the equivalent characters in the string to
which it is compared. In a similar way, the > and => check whether the decimal
values are greater.

Precedence & Order Of Evaluation

Operator

Associativity

( )

Left to Right

! - (unary)

Right to Left

* / %

Left to Right

+ -

Left to Right

< <= > >=

Left to Right

== !=

Left to Right

= += -= *= /= %=

Right to Left

The above table summarises the rules for precedence and associativity of operators
available in the script language. Operators on the same line have the same
precedence; lines are in order of decreasing precedence. So, for example, * / and %
have the same precedence, which is higher than that of + and -.

Note that the brackets have the highest priority and are used to override the default
precedences assumed by the script decoder.

For example:

var %Data
Data = 1 + 2 * 3 + 4
wrt "Data = ", Data, "_n_r"

would output Data = 11, whereas

var %Data
Data = (1 + 2) * (3 + 4)
wrt "Data = ", Data, "_n_r"

would output Data = 21.

This manual is related to the following products: