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.
left_operand * right_operand
Code
4.678 * -23.42
Result
-109.558760
Code
'hello!' * 9
Result
hello!hello!hello!hello!hello!hello!hello!hello!hello!
Code
local(op = \*)
#op(97, 4)
Result
388 The result of 97 * 4
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 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Recent Comments