The standard arithmetic operators are addition, subtraction, multiplication and division. Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. Arithmetic operators work the same in ISML expressions as they do in other common programming languages.
Note
Division by zero is not defined and will result in a runtime exception.
The examples in the table below assume that var
has been assigned the value 2.
Operator | Description | Examples Returning Value 5 |
---|---|---|
+ | Addition | var + 3 |
- | Subtraction | 7 - var |
* | Multiplication | 2,5 * var |
/ | Division | 10 / var |
These operators compare numerical operands and return a Boolean value based on whether or not the comparison is true. The table below shows valid operators.
Operands for arithmetic comparison operators must be classes of type number and their subclasses, e.g., money. The result is of type Boolean
.
The examples in the table below assume that var
has been assigned the value 2.
Operator | Description | Examples Returning True |
---|---|---|
== | Equal: Returns true if the operands are equal. | var == 2 |
!= | Not Equal: Returns true if the operands are not equal. | var != 0 |
>= | Greater Than or Equal To: Returns true if the left operand is greater than or equal to the right operand. | 3 >= var; 2 >= var |
<= | Less Than or Equal To: Returns true if the left operand is less than or equal to the right operand. | var <= 5; var <= 2 |
> | Greater Than: Returns true if the left operand is greater than the right operand. | 12 > var |
< | Less Than: Returns true if the left operand is less than the right operand. | 1 < var |
Logical operators are used to build complex expressions that evaluate to true
or false
.
Type of operands: Boolean; result type: Boolean.
For the examples in the table below assume that variable var_true
has been assigned the value of true
and var_false
the value of false
.
Operator | Description | Examples Returning True |
---|---|---|
AND | Returns | var_true AND var_true |
OR | Returns | var_true OR var_false |
NOT | Returns | NOT var_false |
Use the Concatenation Operator to concatenate two strings and return another string that is their union. If an operand is not a string, it is automatically converted into a string.
Type of operands: String
, result type: String
.
Operator | Description |
---|---|
. | Period: Returns the concatenation of two string operands. |
These operators compare string operands and return a logical value based on the comparison. The value is equal only if both combined strings contain exactly the same characters. In the case that an operand is not of type string, it is automatically converted into a string.
Type of operands: String
, result type: Boolean
.
Operator | Description |
---|---|
EQ | Returns |
NE | Returns |