SPLat Logo

Compare

NOTICE: SPLat Controls has moved. We are now at 1/85 Brunel Rd, Seaford, 3198. map

Compare

X = (X == Y) ? 0 : ((X > Y) ? 1 : 2); (X = Z; Y = T)

Compare makes a numeric comparison between X and Y, and leaves a result code in X.  The original X and Y values are Popped off the register stack.

The result codes are:

X vs Y Code
X=Y 0
X>Y 1
X<Y 2

Here's a handy list you may like to include in your program


;Compare result
CMPkXeqY EQU 0
CMPkXgtY EQU 1
CMPkXltY EQU 2

These equates can then be used like this:


Compare
GoIfXne CMPkXeqY,_DoesntMatch ;abort if X & Y don't match

 

Dialect restriction: Compare is implemented only in dialects 4 or later.

See also CompareR, fCompareR