Compare Method for LCNumeric

This method compares two LCNumeric objects.

Defined In

LCNumeric

Syntax

result = numericFirst. Compare (numericSecond)

Parameters

Parameter

Description

numericSecond

The base value to which to compare another value.

Return Value

Value

Description

result

Long. Result of the comparison:

Result > 0 (positive) -- numericFirst is greater than numericSecond.

Result < 0 (negative) -- numericFirst is less than numericSecond.

Result = 0 -- numericFirst is equal to numericSecond.

Example

Option Public
Uselsx "*lsxlc" 
Sub Initialize
  Dim num1 As New LCNumeric
  Dim num2 As New LCNumeric
  Dim diff As Long
  num1.Value = 123.456789
  num2.Value = 123
  diff = num1.Compare (num2)
  If (diff = 0) Then
    Print "The first number is the same as the second."
  Elseif (diff > 0) Then
    Print "The first number is greater than the second."
  Else
    Print "The first number is less than the second."
  End If
End Sub

Example Output

The first number is greater than the second.