======Detailed Precedence Table====== The table below shows all the Operators that PTPScript supports, according to their precedence (importance), along with their type and associativity. The Operators with highest precedence (most important) are at the top. The actual level of each Operator is also shown. ^ Level ^ Type ^ Symbol ^ Associativity ^ Description ^ ^ Individual terms ^^^^^ | 19 | | | | [[PTPScript:Constants|Constants]] | | 19 | | | | [[PTPScript:Types:Number|Numbers]] | | 19 | | %% " " %% | | [[PTPScript:Types:String|String]] | | 19 | | %% ' ' %% | | [[PTPScript:Types:String|String]] | | 19 | | %% ` ` %% | | [[PTPScript:Types:String|String]] | | 19 | | %% """ """ %% | | [[PTPScript:Types:String|String]] | | 19 | | %% ''' ''' %% | | [[PTPScript:Types:String|String]] | | 19 | | | | [[PTPScript:Variables|Variables]] | ^ Glued terms ^^^^^ | 18 | Prefix | %% . %% | None | Used with ''With'' command | | 18 | Infix | %% . %% | Left | [[PTPScript:Types:Array|Array]] syntax | | 18 | Infix | %% .. %% | Left | **''%%__CurrentLoop__%%''** shortcut | ^ Grouped terms ^^^^^ | 17 | Prefix | %% [ %% | None | [[PTPScript:Types:Array|Array]] syntax | | 17 | Infix | %% [ %% | Left | [[PTPScript:Types:Array|Array]] syntax | | 17 | Prefix | %% ] %% | None | [[PTPScript:Types:Array|Array]] syntax | | 17 | Postfix | %% ] %% | None | [[PTPScript:Types:Array|Array]] syntax | | 17 | Prefix | %% ( %% | None | Parentheses | | 17 | Infix | %% ( %% | Left | Parentheses | | 17 | Prefix | %% ) %% | None | Parentheses | | 17 | Postfix | %% ) %% | None | Parentheses | ^ Auto-increment ^^^^^ | 16 | Prefix | %% ++ %% | None | Auto-increment | | 16 | Postfix | %% ++ %% | None | Auto-increment | | 16 | Prefix | %% -- %% | None | Auto-decrement | | 16 | Postfix | %% -- %% | None | Auto-decrement | ^ Exponentiation ^^^^^ | 15 | Infix | %% ** %% | Left | Exponentiation (raise to power) | ^ Symbolic unary ^^^^^ | 14 | Prefix | %% + %% | None | Cast to [[PTPScript:Types:Number|Number]] | | 14 | Prefix | %% - %% | None | Cast to negative [[PTPScript:Types:Number|Number]] | | 14 | Prefix | %% ? %% | None | Cast to [[PTPScript:Types:Boolean|Boolean]] | | 14 | Prefix | %% ! %% | None | Cast to negative [[PTPScript:Types:Boolean|Boolean]] (i.e. logical NOT) | | 14 | Prefix | %% ~ %% | None | Cast to [[PTPScript:Types:String|String]] | | 14 | Prefix | %% @ %% | None | Cast to [[PTPScript:Types:Array|Array]] | | 14 | Prefix | %% +^ %% | None | Numeric bitwise NOT | | 14 | Prefix | %% ~^ %% | None | String bitwise NOT | | 14 | Prefix | %% ?^ %% | None | Boolean bitwise NOT | | 14 | Prefix | %% ??? %% | None | Existence | ^ Multiplication and division ^^^^^ | 13 | Infix | %% * %% | Left | Numeric multiplication | | 13 | Infix | %% / %% | Left | Numeric division | | 13 | Infix | %% % %% | Left | Numeric modulus (remainder) | | 13 | Infix | %% ~* %% | Left | String repetition | | 13 | Infix | %% @* %% | Left | Array repetition | | 13 | Infix | %% +& %% | Left | Numeric bitwise AND | | 13 | Infix | %% ~& %% | Left | String bitwise AND | | 13 | Infix | %% ?& %% | Left | Boolean bitwise AND | | 13 | Infix | %% +< %% | Left | Numeric bitwise shift left | | 13 | Infix | %% ~< %% | Left | String bitwise shift left | | 13 | Infix | %% +> %% | Left | Numeric bitwise shift right | | 13 | Infix | %% ~> %% | Left | String bitwise shift right | ^ Addition and subtraction ^^^^^ | 12 | Infix | %% + %% | Left | Numeric addition | | 12 | Infix | %% - %% | Left | Numeric subtraction | | 12 | Infix | %% ~ %% | Left | String concatenation | | 12 | Infix | %% @ %% | Left | Array merge | | 12 | Infix | %% +| %% | Left | Numeric bitwise OR | | 12 | Infix | %% ~| %% | Left | String bitwise OR | | 12 | Infix | %% ?| %% | Left | Boolean bitwise OR | | 12 | Infix | %% +^ %% | Left | Numeric bitwise XOR | | 12 | Infix | %% ~^ %% | Left | String bitwise XOR | | 12 | Infix | %% ?^ %% | Left | Boolean bitwise XOR | ^ Named unary ^^^^^ | 11 | Prefix | %% destroy %% | None | Destruction | | 11 | Prefix | %% typeof %% | None | Type checking | | 11 | Prefix | %% abs %% | None | Numeric absolute value | | 11 | Prefix | %% cos %% | None | Numeric cosine | | 11 | Prefix | %% log %% | None | Numeric base-10 logarithm | | 11 | Prefix | %% ln %% | None | Numeric natural logarithm | | 11 | Prefix | %% sin %% | None | Numeric sine | | 11 | Prefix | %% tan %% | None | Numeric tangent | ^ Range ^^^^^ | 10 | Infix | %% ... %% | Left | Range | ^ Relational comparison ^^^^^ | **Standard comparison** ||||| | 9 | Infix | %% < %% | Left | Less than | | 9 | Infix | %% <= %% | Left | Less than or equal to | | 9 | Infix | %% > %% | Left | Greater than | | 9 | Infix | %% >= %% | Left | Greater than or equal to | | **String comparison** ||||| | 9 | Infix | %% lt %% | Left | Less than | | 9 | Infix | %% le %% | Left | Less than or equal to | | 9 | Infix | %% gt %% | Left | Greater than | | 9 | Infix | %% ge %% | Left | Greater than or equal to | | **Presence checking** ||||| | 9 | Infix | %% in %% | Left | Simple presence search | ^ Equality comparison ^^^^^ | **Standard comparison** ||||| | 8 | Infix | %% == %% | Left | Equal to | | 8 | Infix | %% != %% | Left | Not equal to | | 8 | Infix | %% <> %% | Left | Not equal to | | 8 | Infix | %% === %% | Left | Identical to | | 8 | Infix | %% !== %% | Left | Not identical to | | **String comparison** ||||| | 8 | Infix | %% eq %% | Left | Equal to | | 8 | Infix | %% ne %% | Left | Not equal to | | **Type checking** ||||| | 8 | Infix | %% is %% | Left | Is //''type''// | ^ Tight logical comparison ^^^^^ | 7 | Infix | %% && %% | Left | Logical AND | | 6 | Infix | %% || %% | Left | Logical OR | | 6 | Infix | %% ^^ %% | Left | Logical XOR | | 6 | Infix | %% |?| %% | Left | Logical ERR | ^ Assignment ^^^^^ | 5 | Infix | %% = %% | Right | Set equal to | | **Exponentiation** ||||| | 5 | Infix | %% **= %% | Right | Exponentiation (raise to power) and set equal to | | **Multiplication and division** ||||| | 5 | Infix | %% *= %% | Right | Numeric multiplication and set equal to | | 5 | Infix | %% /= %% | Right | Numeric division and set equal to | | 5 | Infix | %% %= %% | Right | Numeric modulus (remainder) and set equal to | | 5 | Infix | %% ~*= %% | Right | String repetition and set equal to | | 5 | Infix | %% @*= %% | Right | Array repetition and set equal to | | 5 | Infix | %% +&= %% | Right | Numeric bitwise AND and set equal to | | 5 | Infix | %% ~&= %% | Right | String bitwise AND and set equal to | | 5 | Infix | %% ?&= %% | Right | Boolean bitwise AND and set equal to | | 5 | Infix | %% +<= %% | Right | Numeric bitwise shift left and set equal to | | 5 | Infix | %% ~<= %% | Right | String bitwise shift left and set equal to | | 5 | Infix | %% +>= %% | Right | Numeric bitwise shift right and set equal to | | 5 | Infix | %% ~>= %% | Right | String bitwise shift right and set equal to | | **Addition and subtraction** ||||| | 5 | Infix | %% += %% | Right | Numeric addition and set equal to | | 5 | Infix | %% -= %% | Right | Numeric subtraction and set equal to | | 5 | Infix | %% ~= %% | Right | String concatenation and set equal to | | 5 | Infix | %% @= %% | Right | Array merge and set equal to | | 5 | Infix | %% +|= %% | Right | Numeric bitwise OR and set equal to | | 5 | Infix | %% ~|= %% | Right | String bitwise OR and set equal to | | 5 | Infix | %% ?|= %% | Right | Boolean bitwise OR and set equal to | | 5 | Infix | %% +^= %% | Right | Numeric bitwise XOR and set equal to | | 5 | Infix | %% ~^= %% | Right | String bitwise XOR and set equal to | | 5 | Infix | %% ?^= %% | Right | Boolean bitwise XOR and set equal to | | **Range** ||||| | 5 | Infix | %% ...= %% | Right | Range and set equal to | | **Logical** ||||| | 5 | Infix | %% &&= %% | Right | Logical AND and set equal to | | 5 | Infix | %% ||= %% | Right | Logical OR and set equal to | | 5 | Infix | %% ^^= %% | Right | Logical XOR and set equal to | | 5 | Infix | %% |?|= %% | Right | Logical ERR and set equal to | ^ Loose logical ^^^^^ | 4 | Prefix | %% not %% | None | Logical NOT | | 3 | Infix | %% and %% | Left | Logical AND | | 2 | Infix | %% or %% | Left | Logical OR | | 2 | Infix | %% xor %% | Left | Logical XOR | | 2 | Infix | %% err %% | Left | Logical ERR | ^ Group separators ^^^^^ | 1 | Prefix | %% , %% | None | Parameter separator | | 1 | Infix | %% , %% | Left | Parameter separator | | 1 | Infix | %% : %% | Left | Key:value pair assignment | ^ Comments ^^^^^ | 0 | Prefix | %% // %% | None | Comment | | 0 | Infix | %% // %% | None | Comment | In the table above, some Operators are listed more than once. For instance, closing parentheses - '')'' - are listed as both prefix and postfix, at the same level of precedence. This is because they can be used in both of those positions. Other Operators are listed at different levels - for instance the plus symbol - ''+'' - is listed as a high-precedence prefix operator and a lower-precedence infix operator. This is because the infix version performs numeric addition, and the prefix version is used for [[Type Casting|type-casting]].