 Operators

Xtend IVR scripting language supports the following operators.

### Assignment Operators

Assigns value to a variable.

#### Syntax

result = expression

Eg:
\$A = 2.56
\$A = \$B
\$A = "This is a test"
\$A += 2
\$A += \$B
\$A -= 2
\$A -= \$B

### Arithmetic Operators

Used to perform arithmetic operations.

#### Syntax

result = operand1 < operator > operand2

Parameters

operand 1 : First operand to perform arithmetic operation.
operand 2 : Second operand to perform arithmetic operation.

Operands can be integer, floating point, constants, or variables. Xtend IVR supports both simple and complex arithmetic operations. Following are the arithmetic operators in Xtend IVR:

1. Addition (+)

Used to find the sum of two numbers.

Eg:
\$A = \$A + 2
\$A = \$A + \$B

2. Subtraction (-)

Used to find the difference between two numbers or to indicate the negative value of a numeric expression.

Eg:
\$A = \$A - 2.5
\$A = \$A - \$B

3. Multiplication (*)

Used to multiply two numbers.

Eg:
\$A = \$A * 2.5
\$A = \$A * \$B

4. Division (/)

Used to divide two numbers.

Eg:
\$A = \$A / 2
\$A = \$A / \$B

5. Modulus (%)

Used to find the remainder after the division operation and returns an integer result.

Eg:
\$A = \$A % 2
\$A = \$A % \$B

### Comparison Operators

A Comparison/Relational operator compares two operands and returns a boolean value, TRUE or FALSE.

#### Syntax

operand1 < operator > operand2

Operands can be integer, floating point, constants or variables. Description of the operators and their examples are listed as follows:

 Operator Description Example > Greater than \$A > \$B , 10 > \$A , \$A > 10 < Less than \$A < \$B , 10 < \$A , \$A < 10 >= Greater than or equal to \$A >= \$B , 10 >= \$A , \$A >=10 <= Less than or equal to \$A <= \$B , 10 <= \$A , \$A <=10 <> Not equal to \$A <> \$B , 10 <> \$A , \$A <> 10 != Not equal to \$A != \$B , 10 != \$A , \$A != 10 = Equal to \$A = \$B , 10 = \$A , \$A = 10 == Equal to \$A == \$B , 10 == \$A , \$A == 10

#### Remarks

The comparison operator '=' is also used as an assignment operator. This ambiguity is automatically resolved by the parser depending on the context of their use.

### Bitwise Operators

The bitwise operators perform bitwise comparisons like bitwise-And (&), bitwise-Or ( | ) etc.

#### Syntax

operand1 < operator > operand2

Bitwise operators supported by Xtend IVR and their descriptions are:

 Operator Description Example & And \$A & \$B , \$A & 20 ^ Xor \$A ^ \$B , \$A ^ 20 | Or \$A | \$B , \$A | 10 >> Shift Right \$A >> \$B , \$A >> 10 << Shift Left \$A << \$B , \$A << 10

### Logical Operators

The Logical/boolean operators perform boolean operations like logical-And (&&), logical-Or ( ||) and logical-Not( ! ).

#### Syntax

expression1 < operator > expression2

Logical operators supported by Xtend IVR and their descriptions are:

 Operator Description Example &&/.and./and Logical And (\$A < \$B) .and. (\$A < \$C) ||/.or./or Logical Or (\$A<\$B) or (\$A=20) !/.not./not Logical Not !(5==5)