[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Comparing Objects
When comparing two variables to see if both refer to the same object, the
exact comparison operator (double equal, ==) must be used. The inexact
comparison operator (single equal, =) will cause a runtime error, as will
a 'not equal' (<> or !=). If you wish to check that two variables refer to
different objects, it can be done as follows:
IF !(obj1 == obj2)
This is the standard behaviour of the Clipper language, and similarly
applies to comparisons of arrays.
When comparing an object with NIL, however, the 'not equal' operator can
be used. For example:
IF obj <> NIL
This will work in all cases.
The reason for this behavior is that such comparisons of objects are
actually comparing references to objects (pointers). Asking whether one
such reference is greater than or less than another is meaningless, in the
Clipper environment. The inexact comparison operator is similarly
meaningless.
See Also:
Comparing Classes
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson