Xerox -05W Printer User Manual


 
12-15
Creating A Script File
Equivalence Testing (== !=)
The == and != operators allow you to check that a variable is set to a particular value.
For example, the following lines could be inserted between the 6th and 7th lines in
the above sample code to provide a check for a specific value:
else if (Input == 5)
wrt "That's the value I wanted_n_r"
or alternatively, replace the 7th and 9th lines with the following:
else if (Input != 5)
wrt ("That's not the value I wanted_n_r)
Division Operators (/ %)
The / operator performs a straight forward division operation on two numerics. If the
variable receiving the result of the operation is a float then the defined variable would
hold the exact value, otherwise, with an integer variable, the result would be rounded
down to the nearest integral value. For example:
var %Int
var !Float
Int = Float = 5.0 / 2
wrt "Float result of 5.0 / 2 = ", Float, "_n_r"
wrt "Int result of 5.0 / 2 = ", Int, "_n_r"
exit
would print the two lines:
Float result of 5.0 / 2 = 2.50000
Int result of 5.0 / 2 = 2
Note that the expression 5.0 / 2 is specified, and not 5 / 2. This is to ensure that the
language interpreter performs the arithmetic operation using floats instead of the
default of integers. So if the third line was Int = Float = 5 / 2 the result would be:
Float result of 5 / 2 = 2.00000
Int result of 5 / 2 = 2
The % operator will only work on integer operations. If a floating point operation
contains this operator, the system flag will be set to FALSE, indicating an error, and
the rest of the line will be ignored. The operator is provided as a means to achieve the
remainder of the result of an integral divide. For example:
var %Int
Int = 5 % 2
wrt "result of 5 % 2 = ", Int, "_n_r"
exit
would print the line:
result of 5 % 2 = 1