beautypg.com

AMT Datasouth PAL User Manual

Page 95

background image

89

eq

eq

Description

Compare two objects for equality.

Usage

1Any 2Any

eq

Bool

1Any

Any. First object to compare. With the exception of integer, fixed-point, string,
and name objects, 1Any must have the same object type as 2Any. The operator
will compare integer and fixed-point objects in any combination. The operator
will also compare any combination of string and name objects.

2Any

Any. Second object to compare.

Bool

Boolean. A value of true indicates equality. A value of false indicates inequal-
ity.

Comments

PAL will compare for equality any two objects of the same object type. PAL will also compare any
combination of integer and fixed-point objects, as well as any combination of string and name
objects.

PAL compares strings and names using the standard ASCII character sorting sequence including
case sensitivity. Therefore, the string (abc) does not match the string (ABC).

For composite objects, the two objects must reference the exact same composite data. Therefore,
the PAL sequence "[1 2 3] [1 2 3] eq" produces the result "false". However, the sequence "[1 2
3] dup eq" produces the result "true".

In the first case, the sequence creates two unique arrays which happen to contain the same data.
Since the array objects reference different data within the printer's memory, the objects do not meet
PAL's condition for equality.

In the second case, the sequence creates a single array and a second reference to the same array
data. Since the array objects reference the same data within the printer's memory, the objects meet
PAL's condition for equality.

Hints

PAL uses the same conditions for equality for the eq operator as it does when comparing key
values in dictionaries.