NeturalMath Language Definition and Syntax

Add Operator (+)

The add operator adds two numbers or joins to values together. 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 true
true true true

Bools are treated as a single bit (0 or 1) for the purposes of arithmetic calculations. The Add Operation adds the values, limiting the result to 1 in the case where it would overflow the numeric domain (true plus true). The Add Operation has the same functional result as the Or Operation on boolean values.
:> print true + true

true
:> print true + false

true
:> print false + false

false
:> print false + true

true

Complex

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

Number

Numbers are added together following conventional mathematical rules. The values are added and the sum is returned.
:> print 10 + 2

12
:> print 1234 + 5678

6912

Range

This section is not implemented

Set

This section is not implemented

String

The two strings are concatenated and the new string returned.
:> print 'foo' + 'bar'

'foobar'
:> print 'NeturalMath' + ' is ' + 'great!'

'NeturalMath is great!'

Unit

This section is not implemented

See Also

Data Types
Arithmatic Operators

Last edited Oct 19, 2010 at 4:31 PM by zanethorn, version 5

Comments

No comments yet.