Lasso Soft Inc. > Home

[ Percent ]

Method

The [percent] method formats a number for display as a percentage.

The method has one required parameter, a decimal value to be formatted. 

Note: Calculations may not be performed on a percent object directly, Use the [percent->value] method for this purpose.

  • Syntax
  • Methods
  • Traits
percent( number )
Has methods:
Examples
  • Beginner

Format a number as a percent.

Use the [percent] method. This example shows a various numbers formatted as percent..

Code

var( myValues = array( .02, .135, 2.5, .004, .006 ) )

'Decimal\t\t%\n'
with v in $myValues 
     do => {^
          local( p = percent(#v) )
          #v+'\t'+#p+'\n'         
     ^}

Result

Decimal		%
0.020000	2%
0.135000	14%
2.500000	250%
0.004000	0%
0.006000	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 2014 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft