NeturalMath Language Definition and Syntax

Multiply Operator (*)

The multiply operator multiplies the first value by the second value. The value of the first operand will always take precedent when determining the data type of the result.

Syntax

value * value

Data Types

Bool

Logic Table
right
left false true
false false false
true false true

Bools are treated as a single bit (0 or 1) for the purposes of arithmetic calculations. The Multiply Operation multiplies the values as if they were bits. Functionally, the Subtract operator works the same as the And Operator for boolean values.
:> print true * true

true
:> print true * false

false
:> print false * false

false
:> print false * true

false

Complex

Complex values are subtracted following conventional mathematical rules. The real and imaginary parts are subtracted independently and a new complex is returned.

Number

Numbers are multiplied together following conventional mathematical rules. The first value is multiplied together with the second value and the result returned.
:> print 10 * 2

20
:> print 1234 - 5678

7006652

Range

This section is not implemented

Set

This section is not implemented

String

Strings handle multiplication slightly different from other operators. The second value must be convertible to a number otherwise the system will return an error. The first string is multiplied by the numeric value of the second operand.
:> print 'NeturalMath' * 3

'NeturalMathNeturalMathNeturalMath'
:> "john' * ' 4'

'johnjohnjohnjohn'

Unit

This section is not implemented

See Also

Data Types
Arithmatic Operators

Last edited Oct 19, 2010 at 7:32 PM by zanethorn, version 1

Comments

No comments yet.