Using Mathematical Operators

For numeric data, there are four basic mathematical operations you can perform:

Mathematical Operators

Mathematical Operators

Meaning

Example

- (minus sign)

Subtraction

3-1

/ (forward slash)

Division

3/3

* (asterisk)

Multiplication

3*3

+ (plus sign)

Addition

1+1

Using Operator Precedence

In mathematics, operators are given a precedence to determine how an expression is to be evaluated. Without rules of precedence, mathematical expressions could be ambiguous.

With an expression such as 3 + 4 * 5, the following calculations can be made:

The second option is the correct answer, because the rules of precedence in mathematics state that multiplication has a higher precedence than addition. Operators that have an equal precedence are evaluated from left to right.

PracticeScript follows the mathematical rules of precedence.

 

Related Topics

Using PracticeScript Operators

Using Functions

Using Variables