Operation | | Returned type | | Returned value |
int + int | | int | | the sum of the two values |
float + int
int + float
float + float | | float | | the sum of the two values |
string + string
int + string
float + string
string + int
string + float | | string | | In this case, any int or float is first converted to a string. Then the two strings are concatenated and the resulting string is returned. |
array + array | | array | | The two arrays are concatenated into a new array and that new array is returned. |
mapping + mapping | | mapping | | A mapping with all the index-value pairs from both mappings is returned. If an index is present in both mappings the index-value pair from the right mapping will be used. |
multiset + multiset | | multiset | | A multiset with all the indices from both multisets is returned. |
int - int | | int | | The right value subtracted from the left. |
float - int
int - float
float - float | | float | | The right value subtracted from the left. |
string - string | | string | | A copy of the left string with all occurrences of the right string removed. |
array - array | | array | | A copy of the left array with all elements present in the right array removed. Example: ({2,1,4,5,3,6,7}) - ({3,5,1}) will return ({2,4,6,7}). |
mapping - mapping | | mapping | | A new mapping with all index-value pairs from the left mapping, except those indices that are also present in the right mapping. |
multiset - multiset | | multiset | | A copy of the left multiset without any index present in the left multiset. |
- int | | int | | Same as 0 - int. |
- float | | float | | Same as 0 - float. |
int * int | | int | | the product of the two values |
float * int
int * float
float * float | | float | | the product of the two values |
array(string) * string | | string | | All the strings in the array are concatenated with the string on the right in between each string. Example: ({"foo","bar"})*"-" will return "foo-bar". |
array(array) * array | | array | | All the arrays in the left array are concatenated with the array on the right in between each array. Example: ({ ({"foo"}) ,({"bar"})})*({"-"}) will return ({ "foo","-","bar" }). |
string * int | | string | | This operation will concatenate the string N times. Example: "foo"*3 will return "foofoofoo". |
array * int | | string | | This operation will concatenate the array N times. Example: ({"foo"})*3 will return ({"foo","foo","foo"}). |
int / int | | int | | The right integer divided by the left integer rounded towards minus infinity. |
float / int
int / float
float / float | | float | | The right value divided by the left value. |
string / string | | array(string) | | In symmetry with the multiplication operator, the division operator can split a string into pieces. The right string will be split at every occurrence of the right string and an array containing the results will be returned. Example:
"foo-bar"/"-" will return ({"foo","bar"}) |
string / int | | array(string) | | This will split the string into pieces. The size of the pieces is given by the integer. Only complete pieces will be included in the result, the 'reminder' is discarded. Example:
"foo-bar"/2 will return ({"fo","o-","ba"}) |
string / float | | array(string) | | This is similar to dividing a string with an integer, but it allows fraction-sized segments and the reminder will always be included. Example:
"foo-bar"/2.5 will return ({"fo","o-b","ar"}) |
array / int | | array(array) | | This is similar to dividing a string with an integer, but splits an array. Example:
({1,2,3,4,5,6,7})/2 will return ({({1,2}),({3,4}),({5,6})}) |
array / float | | array(array) | | You should be able to predict what this does by now. :) Example:
({1,2,3,4,5,6,7,8})/2.5 will return ({({1,2}),({3,4,5}),({6,7}),({8})}) |
int % int | | int | | The remainder of a division. If a and b are integers, a%b is the same as a-(a/b)*b |
float % float
int % float
float % int | | float | | The remainder of a division. If a and b are floats, a%b is the same as a-floor(a/b)*b |
string % int | | string | | The remainder of a string division. Example: "foo-bar"%2 will return "r" |
array % int | | string | | The remainder of an array division. Example: ({1,2,3,4,5,6,7})%2 will return ({7}) |