Investment Studio > Expressions > Syntax

Expressions are made up of operands (constants, references or functions) separated by operators. Successful evaluation of an expression yields a value.

Example:

=1 + 2

is an expression made up of two operands (the constants 1 and 2) separated by an operator (+). As you might expect, evaluating it yields the value 3.

The leading equal sign (=) denotes the start of an expression. In contexts where it would be redundant (i.e. when the string following it can only be an expression) it may be implied.

By default, expression evaluation proceeds from left to right. If an expression contains more than one operator, the order of evaluation is determined by operator precedence rules. To change the order of evaluation, enclose the part of the formula to be calculated first in parentheses.

Example:

=2 + 2 div 3

is evaluated in two steps: first 2 div 3 = 0, then 0 + 2 = 2. This is because the integer division operator (div) takes precedence over the addition operator (+).

On the other hand,

=(2 + 2) div 3

is evaluated in the order 2 + 2 = 4, 4 div 3 = 1.

Expression parsing is not case sensitive: whether you write DIV, div or Div, it's the same operator. The same applies to symbols, references and built-in functions.

Note however that macro function names are passed unmodified to the connected ActiveX Scripting engine, and that some engines (e.g. JScript, but not VBScript) are case sensitive.