Lasso Soft Inc. > Home

[ percent->value ]

Method

The [percent->value] method returns the decimal value of the percent.

  • Syntax
percent->value
Examples
  • Beginner

To perform calculations with values cast as percent

Use the [percent->value] method to return the decimal value of the percent, which may be used in calculations. 

This example uses the [percent->value] method to calculate the sale price of an item at different discounts.

Code

var( discounts = array( percent(.1), percent(.13), percent(.05), percent(.2) ),
     itemPrice = 35.00 )

with d in $discounts
     do => {^
          local( salePrice = currency($itemPrice - $itemPrice*#d->value))
          'At '+#d+' off: '+#salePrice+'\n'
     ^}

Result

At 10% off: $31.50
At 13% off: $30.45
At 5% off: $33.25
At 20% off: $28.00

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