<>
inequality
simple, class, class reference, interface, string, packed string Boolean
X <> Y
<
less-than
simple, string, packed string, PChar
Boolean
X < Y
>
greater-than
simple, string, packed string, PChar
Boolean
Len > 0
<=
less-than-or-equal-to
simple, string, packed string, PChar
Boolean
Cnt <= I
>=
greater-than-or-equal-to simple, string, packed string, PChar
Boolean
I >= 1
For most simple types, comparison is straightforward. For example,
I = J
is True just in case
I
and
J
have the
same value, and
I <> J
is True otherwise. The following rules apply to relational operators.
Operands must be of compatible types, except that a real and an integer can be compared.
Strings are compared according to the ordinal values that make up the characters that make up the string.
Character types are treated as strings of length 1.
Two packed strings must have the same number of components to be compared. When a packed string with
n
components is compared to a string, the packed string is treated as a string of length
n
.
Use the operators
<,
>,
<=, and
>= to compare PChar (and PWideChar) operands only if the two pointers point
within the same character array.
The operators
= and
<> can take operands of class and class-reference types. With operands of a class
type,
= and
<> are evaluated according the rules that apply to pointers:
C = D
is True just in case
C
and
D
point
to the same instance object, and
C <> D
is True otherwise. With operands of a class-reference type,
C = D
is True just in case
C
and
D
denote the same class, and
C <> D
is True otherwise. This does not compare the
data stored in the classes. For more information about classes, see Classes and objects.
Class Operators
The operators as and is take classes and instance objects as operands; as operates on interfaces as well. For more
information, see Classes and objects and Object interfaces.
The relational operators
= and
<> also operate on classes.
Dostları ilə paylaş: