pTAL Reference Manual (H06.08+)
Expressions
HP pTAL Reference Manual—523746-006
5-28
Group Comparison
Figure 5-3 on page 28 is the same as Figure 5-2 on page 5-27 except that in
Figure 5-3 on page 5-28, y is a 2-byte STRING array. The IF statement, therefore,
compares x to y on a byte-by-byte basis. Because the first (upper) bytes of x and y
are equal, the comparison continues to the second byte.
Because the second byte of x is “B”, but the second byte of y is “C”, the conditional
expression is false. In Figure 5-3 on page 5-28, therefore, the IF statement stores in p
the address of the second (lower) byte of x.
Figure 5-3. Ending Address After Comparing Strings of Data Type STRING and
INT
PROC p;
BEGIN
INT x[0:1] := ["AB","CD"];
STRING y[0:1] := ["A","C"];
STRING p;
INT q;
IF x = y FOR 1 WORDS -> @p THEN ... ;
q := p; ! Assign "BC" to q
END;
Figure 5-2. Ending Address After Comparing INT Strings (page 2 of 2)
User Data Segment ABCD
X
AX
Y
VST131.vsd
P
User Data Segment ABCD
X
AC
Y
VST132.vsd
P










