# NeturalMath Language Definition and Syntax

## Operators

Operators are the key units of functionality in mathematics. In the broadest possible sense, an operator is a unit of code which takes two values and returns a different value based on some type of mathematical behavior. Operators represent a critical piece
within any mathematical statement.

### General Operator Syntax

Operators must be preceded and followed by an assignable expression

*assignable* **{OP}** *assignable*

Typically, operators will be used within a function or

variable declaration.

*variable* = *assignable* **{OP}** _assignable

The example below shows the use of some operators.

x = 2 + 2 // add operator
y = sin(x) * 10 // multiply operator
z = y > 5 // greater-than operator
w = y <> 12 // not-equals operator

### Operators and Data Types

Because NeturalMath uses dynamic variable types, it is important to understand how operators will work when used on various types of data. When dealing with an operator, the data type of the first operand (the argument on the left side of the operator) will
always take precedent over the second operand. This means that the second operand will be converted to the same type as the first operand for the purposes of computing the result of the operation (there are a few exceptions to this rule). This means that the
order of operations is not reversible when the data types are not identical. Consider the following example.

:> x = 10
:> y = '12'
:> print x + y
22
:> print y + x
'1210'

In the first case in the example above, the value

'12' is converted to the number 12 because the first value in the operation is a number. In the second case, the number 12 is converted to a string and concatenated
with the string value for

y. Because of this behavior, it is very important to pay attention to the order in which operations are performed when dealing with data of different types.

### See Also

Data Types