Lasso Soft Inc. > Home

[ decimal->oncompare ]

Method

[decimal->oncompare] compares the decimal to a required parameter, which may be either a decimal or an integer. Returns -1 if the decimal is less than the parameter, 0 if the decimal is equal to the parameter, or 1 if the decimal is greater than the parameter.

  • Syntax
Decimal Value->onCompare(Decimal Value)
Decimal Value->onCompare(Integer Value)
Examples
  • Beginner

To compare a decimal to another number:

Use the [decimal->oncompare] method. The following examples compare a decimal to various numbers and return appropriate results.

Code

local(d) = decimal(1.5)
#d->oncompare(1.0)
'<br>'
#d->oncompare(1.5)
'<br>'
#d->oncompare(1.9)

Result

1
0
-1

Recent Comments

No Comments found

Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft