Mathematical Operators

Mathematical operators perform arithmetic.

+

Addition or positive—commutative.

  • Unary: positive integer

    Example:

    +1
  • Binary: addition

    Example:

    2 + 3

-

Subtraction or negative—non-commutative.

  • Unary: negative integer

    Example:

    -1
  • Binary: subtraction

    Example:

    3 — 2

*

Multiplication—commutative.

Example:

5 * 10

/

Division—noncommutative.

Example:

100 / 10

mod

Modulus (integer)—returns the remainder of two divisibles.

Example:

18 mod 5

returns 3.