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
Like
Like case-insensitive
Returns a Boolean indicating the String in Expression 1 is like the String-pattern given in Expression 2
Contains
ContainsCI
Contains
Contains case-insensitive
Returns a Boolean indicating the String in Expression 1 contains the String given in Expression 2
StartsWith
StartsWithCI
Starts with
Starts with case-insensitive
Returns a Boolean indicating the String in Expression 1 starts with the String given in Expression 2
EndsWith
EndsWithCI
Ends with
Ends with case-insensitive
Returns a Boolean indicating the String in Expression 1 ends with the String given in Expression 2
InIn arrayReturns a Boolean indicating the Array given in Expression 1 contains an element that is equal to the value of Expression 2
??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.