# Operators

## Common Arithmetic Operators

These operators should be consistent across every language.

+ operator Example:

xresult = 2 + 2result += 1  # most languages have this too# If your language doesn't, it'd look like this:result = result + 1

#### Subtraction

- operator Example:

xxxxxxxxxxresult = 3 - 2result -= 1  # most languages have this too# If your language doesn't, it'd look like this:result = result - 1

#### Multiplication

* operator Example:

xxxxxxxxxxresult = 3 * 2result *= 4  # most languages have this too# If your language doesn't, it'd look like this:result = result * 4

#### Division

/ operator Example:

xxxxxxxxxxresult = 4 / 2result /= 2  # most languages have this too# If your language doesn't, it'd look like this:result = result / 2

#### Modulo

% operator Example:

xxxxxxxxxx--[[Modulo, or modulus, is a special operator.  It returns the **remainder** of dividing two numbers.  For example, when you divide 4 by 2, you have nothing left over, so 4 % 2 will return 0.  But when you divide 3 by 2, two goes into 3 once, leaving 1 left over.  Therefore, 3 % 2 will return 1]]local result = 3 % 2print(result)  -- will print "1"

One of modulo's main uses, is to check if something is a factor of something else. For example, if number x is evenly divisible by number y (dividing them results in a remainder of 0), then y is a factor of x. Therefore, to check if y is a factor of x, you'd simply have to check if (x % y == 0).