An operator is used to transform one or more values into a single resultant value. The values to which the operator applies are referred to as operands. The combination of an operator and its operands is referred to as an expression.
For example, in the expression
2 + 3 the operator + is used to transform the operands 2 and 3 into the resultant value 5.
Some operators result in a value being assigned to a variable, e.g. the assignment operator = in
x = 0;Others produce a value that may be used in other expressions, like
2 + 3For some operators the order of the operands does not matter:
2*3is 6, the same is
3*2Other operators give different results for different orderings:
3-2is 1.
2-3is -1.
Some operators are used only with one operand. They are called unary as opposed to binary operators, which have two operands. Examples of unary operands: ! (logical not) and – (unary negation, as in –4 (negative numbers)).
You can combine several operators and operands to make complex expressions. To evaluate complex expressions, you must use rules of order of precedence to know which expressions to evaluate first.
In the following part of the documentation, we will go through the most common JavaScript and JScript operators. Since both JavaScript and JScript originate from the same base, most operators can be used freely between the two languages. Some operators that are seldom used in Forsta Plus scripts are left out. For a full overview, refer to either a JScript .Net or JavaScript reference manual.