Operators

Operators are applied to data values or combine several data values (e.g. "1 + 1"). When an expression contains multiple operators the operators are applied in sequence according to a standard set of rules of operator precedence. Table 2 lists the available operators in order of precedence from highest to lowest. For example, in the expression "1 + 2 * 3" we can tell the multiplication will occur before the addition because multiplication is listed first in the precedence table. Where several identical operators occur in a row they are evaluated from left to right. Parentheses may be used to explicitly control the order of evaluation (e.g. "(1 + 2) * 3").

Some of the operators have several aliases. For example the relational 'less than' operator can be represented by the symbols 'lt' or '<'. There is no difference between these two usages. Capitalization does not matter in operator symbols ('AND' is the same as 'And' is the same as 'and').

An expression may be composed of several sub-expressions, each separated by the semicolon (;) character. The sub-expressions will be evaluated in sequence, and the returned value of the expression will be the value of the final sub-expression. Values produced by the initial sub-expressions will be discarded, however these sub-expressions may have side effects (e.g. the setVar() function) that influence subsequent sub-expressions.

OperatorSyntaxDescriptionResult

Bitwise Compliment

`~ <integer>`

Performs a bitwise complement operation. The result will always be an integer.

<integer>

Logical Not

`not <bool>`

`! <bool>`

Performs a logical not operation on a boolean value. If the operand is true, the result will be false. If the operand is false, the result will be true.

<bool>

Negation

`- <integer>`

`- <number>`

Returns the negative of the original value.

<int> or <number>

Product

`<value> * <value>`

`<value> / <value>`

`<value> % <value>`

Multiple, divide or modulo two values. If both values are integers the result will be an integer. If one of both of the values is a number the result will be a number.

<int> or <number>

Summation

`<value> + <value>`

`<value> - <value>`

Add or subtract two values. If both values are integers the result will be an integer. If one of both of the values is a number the result will be a number.

<int> or <number>

Concatenation

```<string> + <value>```

The string values of the two operands are concatenated together. If one of the operands is not a string value, it will undergo automatic promotion to a string.

<string>

Bit shift

```<int> >> <int>```

```<int> << <int>```

```<int> >>> <int>```

These operators implement bit operations for logical shift right '>>>', signed shift right '>>' and shift left '<<'. The value on the left is the bit field to be shifted, and the value on the right is the amount of the shift. These operators always return an integer bitfield.

<int>

Relational

```<value> op <value>```

where op can be:

`< or 'lt'`

`<= or 'le'`

`> or 'gt'`

`>= or 'ge'`

Compare two values using a relational operator. The values may be both strings (in which case a lexicographical comparison is made), both integers (an integer comparison is made), or a combination of integers and numbers (automatic type promotion occurs and the numbers are compared).

<bool>

value in list

```<string> op <string>```

```<string> op <list>```

where op can be:

`in`

`inIgnoreCase`

If the right operand is a string it is assumed to be a comma-separated list of string values (e.g. 'A,B,C') and will be converted to a list using the split function. The 'in' operator will test to see if the left operand is equal to any of the values in the right hand list. If an exact match is found the result will be true, otherwise false.

<bool>

Inequality

```<value> != <value>```

```<value> ne <value>```

The inequality operator performs a test to see if the two operands are not equal. The result is always a boolean.

<bool>

Equality

`<value> = <value>`

```<value> == <value>```

```<value> eq <value>```

The equality operator performs a test to see if the two operands are equal. The result is always a boolean.

<bool>

Binary 'and'

`<int> & <int>`

The binary 'and' operator combines the bit fields in two integers using an 'and' operation. The result is always an integer.

<int>

Binary 'xor'

`<int> ^ <int>`

The binary 'exclusive or' operator combines the bit fields in two integers using an 'xor' operation. The result is always an integer.

<int>

Binary 'or'

`<int> | <int>`

The binary 'or' operator combines the bit fields in two integers using an 'or' operation. The result is always an integer.

<int>

Logical 'and'

`<bool> and <bool>`

```<bool> && <bool>```

The logical 'and' operator combines two boolean operands. The results is 'true' only if both operands evaluate to 'true'.

<bool>

Logical 'or'

`<bool> or <bool>`

`<bool> || <bool>`

The logical 'or' operator combines two boolean operands. The results is 'true' if either operand evaluates to 'true'.

<bool>