Lasso Soft Inc. > Home

[ * ]

Method

The multiplication operator takes two operands and multiplies the left-hand operand by the right-hand operand. A new resulting value is returned. Objects can implement their own custom multiplication method to tailor the behavior of this operation.

Most types do not contain their own multiplication operator. Attempting to multiply two objects which do not support this operation will generate a failure.

When multiplying an integer and a decimal, the result will always be a decimal, regardless of which side of the operation the decimal resided.

String objects support multiplication against an integer. the integer represents the number of time which the string operand should be repeated. A new string value is returned.

Also provided is a stand-alone multiplication method which can be accessed using the escape method operator. This permits multiplication operations to be passed as values and later invoked for whatever reason. This method eventually calls the * operator on the left-hand operand.

  • Syntax
left_operand * right_operand
Examples
  • Beginner
  • Intermediate

Multiply two decimal values.

Code

4.678 * -23.42

Result

-109.558760

Repeat a string 9 times.

Code

'hello!' * 9

Result

hello!hello!hello!hello!hello!hello!hello!hello!hello!

Obtain the stand-alone multiplication method and use it to multiply two integers.

Code

local(op = \*)
#op(97, 4)

Result

388
The result of 97 * 4

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