Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Warning

Looking for the documentation on the newest versions of SIL Engine and the Simple Issue Language for Jira 8 for Server/Data Center? Click here !

Contents

Table of Contents
 

Arithmetic, Logical and Comparison Operators

Here is a list of the available operators in a SIL SIL™ program and detailed usage information.

...

For each operator and LHS type, we define two lists: valid types and convertible types. The list of convertible types is based on Type Conversionconversion. This creates three cases:

...

Operator

LHS type

Valid Types

Result

Explanations and Usage

+

number

numbernumber

standard addition of numbers

stringstringstringadds the string representation of the RHS operand at the end of the LHS string
booleanUnsupported
dateintervaldateadds the interval to the date and returns the result
intervalintervalintervaladds the two intervals and returns the result
datedateadds the interval to the date and returns the result
<type> []<type><type> []adds the RHS value to the LHS array, where <type> can be any type.

-

number

number

number

standard subtraction of numbers

stringstringstringremoves all occurrences of the RHS string in the LHS value
booleanUnsupported
datedateintervalreturns the interval difference between the two dates
intervaldatesubtracts the RHS interval from the date and returns the value
intervalintervalintervalstandard interval subtraction
<type>[]<type><type>[]removes the first occurrence of the RHS value from the array; <type> can be any type.
*numbernumbernumberstandard multiplication of numbers
intervalintervalmultiplies the interval by the number of times specified by the LHS operand and returns the result
number [] numbernumber []

multiplies each value in the LHS array with the number in the RHS operand and returns the result

stringUnsupported
booleanUnsupported
dateUnsupported
intervalnumberintervalmultiplies the interval by the number of times specified by the RHS operand and returns the result

<type>[]

(except number)

Unsupported
/




number

numbernumberstandard division of numbers
number []numbernumber []divides each value in the LHS array by the number in the RHS operand and returns the result
stringUnsupported
booleanUnsupported
dateUnsupported
intervalnumberintervaldivides the interval by the number specified in the RHS operand

<type>[]

(except number)

Unsupported
%numbernumbernumberstandard modulo division of numbers
number []numbernumber []applies the modulo operator on each number in the LHS array with the number in the RHS operand and returns the results
stringUnsupported
booleanUnsupported
dateUnsupported
intervalUnsupported

<type>[]

(except number)

Unsupported
Tip

You can also use the combined forms of the arithmetic operators with the attrib operator: +=, -=, *= and /=.

Code Block
string s = "a";
s = s + "b";
// is equivalent with
s += "b"; 

...

Operator

Operands

Return

Explanations and Usage

?:boolean, <type>, <type><type>
Code Block
<condition> ? <ifTrueValue> : <ifFalseValue>

If <condition> is true, returns <ifTrueValue>, otherwise returns <ifFalseValue>.

Note that <ifTrueValue> and <ifFalseValue> must have same type.

...


Anchor
index-operator
index-operator
The Indexing Operator

...

The indexing operator can also be used with certain simple types (not arrays) and a specific value to provide additional functionality.

SIL SIL™ typeIndex ValueGetGet Return TypeSet
stringa numberGets the character at the specified index in the stringstringInserts a character at the specified index. If given a longer string, it will insert the first character of the string.
date"DAY"Gets the day of month from the datenumberUnsupported
"MONTH"Gets the month from the datenumberUnsupported
"YEAR"Gets the year from the datenumberUnsupported
"HOUR"Gets the hour (0-23) from the datenumberUnsupported
"MINUTE"Gets the minute (0-59) from the datenumberUnsupported
"SECOND"Gets the seconds (0-59) from the datenumberUnsupported
"MILLISECOND"Gets the milliseconds (0-999) from the datenumberUnsupported
"WEEK"Gets the week number within the current yearnumberUnsupported
"WEEKINMONTH"Gets the week number within the current monthnumberUnsupported
"TOMILLIS"Gets the current time as UTC milliseconds from the epoch.numberUnsupported
"DAYOFWEEK"Gets the three letter format for the day of the week (e.g. "Mon", "Tue", "Wed" etc)stringUnsupported
"MONTHNAME"Gets the three letter format for the name of the month (e.g. "Jan", "Feb", "Mar", etc.)stringUnsupported
interval"WEEK"Gets the number of whole weeks inside the interval (e.g. interval i = "1w 14d"; i["WEEK"] will return 3)numberUnsupported
"DAY"Gets the number of whole days inside the interval (e.g. interval i = "1d 48h"; i["DAY"] will return 3)numberUnsupported
"HOUR"

Gets the number of whole hours inside the interval (e.g. interval i = "1h 120m"; i["HOUR"] will return 3)

numberUnsupported
"MINUTE"Gets the number of whole miuntes inside the interval (e.g. interval i = "1m 120s"; i["MINUTE"] will return 3)numberUnsupported
"SECOND"Gets the number of seconds inside the interval (e.g. interval i = "1h 1m 3s"; i["SECOND"] will return 3)numberUnsupported
"TOMILLIS"Gets the number of milliseconds inside the intervalnumberUnsupported

...


See also

...

...