The following operators are supported in Sling expressions, sorted according to their type and precedence:
Legacy Static Cast Expression
(<data type>) Convert the data type of a variable to another (for backwards compatibility only, use "as" or "as!" operators instead)
Pre Unary Expressions
+ Explicitly mark an expression as a positive number
- Change the sign of a number expression
! Change the logical value to opposite
not Change the logical value to opposite
~ Bitwise not operation
++ Increment value by one
-- Decrement value by one
Post Unary Expressions
++ Increment value by one after determining the value of the expression
-- Decrement value by one after determining the value of the expression
Operative Binary Expressions (2)
* Multiplication
/ Division
% Modulo (remainder)
Operative Binary Expressions (1)
| Bitwise OR
^ Bitwise XOR
& Bitwise AND
<< Bit Shift Left
>> Bit Shift Right
+ Addition
- Subtraction
.. String Concatenation
Comparison Binary Expressions
== Equality
!= Not equality
< Less than
<= Less or equal than
> Greater than
>= Greater or equal than
is Runtime data type checking
as Dynamic type casting
as! Static type casting
Logical Binary Expressions
|| Logical OR
&& Logical AND
Conditional Expression
<condition> ? <true expression> : <false expresion>
Assignment Expressions
= Assignment
+= Increment assignment
-= Decrement assignment
|= Bitwise OR assignment
&= Bitwise AND assignment
^= Bitwise XOR assignment
/= Division assignment
*= Multiplication assignment
%= Modulo assignment
<<= Bit shift left assignment
>>= Bit shift right assignment
>>>= Bit shift right assignment and clear the leftmost bits