Operators

Polar Script supports the following operators

OperatorNameNotes
+AddAdd two numbers. The resulting type is the most 'generous' type of the given types.
-SubtractSubtract the second number from the first number. The resulting type is the most 'generous' type of the given types.
/DivideDivide the first number by the second number. The resulting type is a Double
\Integer divideDivide the first number by the second number and round down. The resulting type is a Long
*MultiplyMultiply two numbers. The resulting type is the most 'generous' type of the given types.
^Powera^b results in a to the power of b. Returns a Double
ModRemainderReturns the remainder of expression 1 divided by expression 2. Both values are first rounded to the nearest whole number before the operation is evaluated. The result is a Long
%RemainderReturns the remainder of expression 1 divided by expression 2. Is like Mod, however, this version uses unrounded Doubles.
&ConcatenateConcatenate two expressions. Returns a String
NotBitwise NotInverts the bits in the given number. If a boolean is passed, a boolean is returned. If a Long is passed, a Long is returned.
!Boolean NotReturns the boolean opposite of the passed value (always True or False)
AndBitwise AndReturns a bitwise AND for to Long values or a Boolean if both values were boolean
&&Boolean AndThis shortcutted Boolean AND returns the Boolean result of expression 1 AND expression 2.
This operator is 'shortcutted' meaning Expression 2 is only evaluated if Expression 1 returned True.
OrBitwise OrReturns a bitwise OR for to Long values or a Boolean if both values were boolean
||Boolean OrThis shortcutted Boolean OR returns the Boolean result of expression 1 OR expression 2.
This operator is 'shortcutted' meaning Expression 2 is only evaluated if Expression 1 returned False.
XorBitwise OrReturns a bitwise Exclusive-OR for to Long values or a Boolean XOR result if both values were boolean
=
==
EqualsReturns a boolean indicating value 1 equals value 2. Please note that == does exactly the same as = and is added to allow programmers to use C#/C++/Javascript alike expressions.
>Greater thanReturns a boolean indicating value 1 is greater than value 2
>=Greater than or equalsReturns a boolean indicating value 1 is greater than value 2
<Lesser thanReturns a boolean indicating value 1 is lesser than value 2
<=Lesser than or equalsReturns a boolean indicating value 1 is lesser than or equal to value 2
<>
!=
Not equalsReturns a boolean indicating value 1 is not equal to value 2
IsIsReturns a boolean indicating object 1 is the same object as object 2
IsNotIs notReturns a boolean indicating object 1 is not the same object as object 2
Like
LikeCI
NotLike
NotLikeCI
Like
Like case-insensitive
Returns a Boolean indicating the String in Expression 1 is (not) like the String-pattern given in Expression 2
Contains
ContainsCI
NotContains
NotContainsCI
Contains
Contains case-insensitive
Returns a Boolean indicating the String in Expression 1 (not) contains the String given in Expression 2
StartsWith
StartsWithCI
NotStartsWith
NotStartsWithCI
Starts with
Starts with case-insensitive
Returns a Boolean indicating the String in Expression 1 (not) starts with the String given in Expression 2
EndsWith
EndsWithCI
NotEndsWith
NotEndsWithCI
Ends with
Ends with case-insensitive
Returns a Boolean indicating the String in Expression 1 (not) ends with the String given in Expression 2
In
InCI
NotIn
NotInCI
In array
In array case-insensitive
Returns a Boolean indicating the Array given in Expression 2 (not) contains an element that is equal to the value of Expression 1. For object variables, not the values are compared, but only if the exact object from Expression 1 is contained in the array in Expression 2. For InCI / NotInCI, Expression 1 must be a String and the array is expected to contain strings as well.
??CoalesceEvaluates expression 1. If this value is NOT an empty value then this value is returned. Else expression 2 is evaluated and its result is returned.
???String CoalesceEvaluates expression 1 and converts to a string. If the result is NOT an empty string then this value is returned. Else expression 2 is evaluated and its result is returned as a string.