NeturalMath Language Definition and Syntax

Subtract Operator (-)

The subtract operator subtracts the second value from the first. 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 true false

Bools are treated as a single bit (0 or 1) for the purposes of arithmetic calculations. The Subtract Operation adds the values, limiting the result to 0 in the case where it would yield a result that is less than zero. Functionally, the Subtract operator will only return true if the first value is true, and the second value is false
:> print true - true

false
:> print true - false

true
:> 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 added together following conventional mathematical rules. The second value is subtracted from the first and the difference is returned.
:> print 10 - 2

8
:> print 1234 - 5678

-4444

Range

This section is not implemented

Set

This section is not implemented

String

Any occurrence of the second string is removed from the first string. This returns a new string without the text contained within the first string.
:> print 'NeturalMath is cool' - 'is cool'

'NeturalMath '
:> "This is a short string' - ' '

'Thisisashortstring'

Unit

This section is not implemented

See Also

Data Types
Arithmatic Operators

Last edited Oct 19, 2010 at 3:34 PM by zanethorn, version 3

Comments

No comments yet.