by VB-kung-Fu (19 Submissions)
Category: Math/Dates
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Thu 9th October 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Compares numbers are returns the larger, smaller or difference value
API Declarations
rtpReturnLarger
rtpReturnSmaller
rtpReturnDifference
End Enum
'if just the difference is required then get it and exit
If ReturnPreference = rtpReturnDifference Then
CompareNums = Abs(FirstNum - SecondNum)
Exit Function
End If
'compare the nums
If FirstNum > SecondNum Then
'return according to the user's liking
If ReturnPreference = rtpReturnLarger Then
CompareNums = FirstNum
ElseIf ReturnPreference = rtpReturnSmaller Then
CompareNums = SecondNum
End If
ElseIf FirstNum < SecondNum Then
'return according to the user's liking
If ReturnPreference = rtpReturnLarger Then
CompareNums = SecondNum
ElseIf ReturnPreference = rtpReturnSmaller Then
CompareNums = FirstNum
End If
Else 'the numbers are equal just return any
CompareNums = FirstNum
End If
End Function
No comments have been posted about Compares numbers are returns the larger, smaller or difference value. Why not be the first to post a comment about Compares numbers are returns the larger, smaller or difference value.