Other operators

Provides a reference of other operators used in OPL.

Other operators are described in detail in the section dedicated to the data type they operate on.

Table 1. Other operator syntax 
Syntax Effect

- X

X + Y

X - Y

X * Y

X / Y

X % Y

Arithmetic operators.

These operators perform the usual arithmetic operations. In addition, the + operator can be used to concatenate strings. See Numeric operators and String operators.

X == Y

X != Y

Equality operators.

These operators can be used to compare numbers and strings; see Numeric operators and String operators.

For other types of values, such as dates, arrays, and objects, the == operator is true if, and only if, X and Y are the exact same value. For example:

new Array(10) == new Array(10) false var a = new Array(10); a == a true

X > Y

X >= Y

X < Y

X <= Y

Relational operators.

These operators can be used to compare numbers and strings. See Numeric operators and String operators.

~ X

X & Y

X | Y

X ^ Y

X << Y

X >> Y

X >>> Y

Bitwise operators.

See Numeric operators.

! X

X || Y

X && Y

condition ? X : Y

Logical operators.

See Logical operators.