FANDOM


Operator Example Name Explanation
Variable Operators
$ global $a $a is a global variable
% local %b %b is a local variable
Arithmetic Operators
* multiplication $a*$b Multiply $a and $b
/ division $a/$b Divide $a by $b
% modulo $a % $b Remainder of $a divided by $b.
+ addition $a + $b Add $a and $b
- Subtraction $a - $b Subtract $b from $a
++ auto-increment (post-fix only) $a++ Increment $a after use. Note: ++$a is illegal.
-- auto-decrement (post-fix only) $b-- Decrement $b after use. Note: --$b is illegal.
Relations and Logical Operators
< Less than $a < $b 1 if $a is less than $b 0 otherwise
> More than $a > $b 1 if $a is greater than $b 0 otherwise
<= Less than or Equal to $a <= $b 1 if $a is less than or equal to $b 0 otherwise
>= More than or equal to $a >= $b 1 if $a is greater than or equal to $b 0 otherwise
== Equal to $a == $b 1 if $a is equal to $b 0 otherwise
 != Not equal to $a != $b 1 if $a is not equal to $b 0 otherwise
 ! Logical NOT  !$a 1 if $a is 0, 0 otherwise
&& Logical AND $a && $b 1 if $a and $b are both non-zero, 0 otherwise
|| Logical OR $a || $b 1 if either $a or $b is non-zero, 0 otherwise
Bitwise Operators
~ Bitwise complement ~$a Flip bits 1 to 0 and 0 to 1 (i.e., ~10b == 01b)
& Bitwise AND $a & $b composite of elements where bits in same position are 1. (i.e., 1b & 1b == 1b)
| Bitwise OR $a | $b composite of elements where bits 1 in either of the two elements. (i.e., 100b | 001b == 101b)
^ Bitwise XOR $a ^ $b composite of elements where bits in same position are opposite (i.e., 100b ^ 101b == 001b)
<< Left Shift $a << 3 element shifted left by 3 and padded with zeros (i.e., 11b << 3d == 11000b)
>> Right Shift $a >> 3 element shifted right by 3 and padded with zeros (i.e., 1010b >> 3d == 00011b)
Assignment Operators
= Assignment $a = $b; Assign value of $b to $a.
op= Compound Assignment $a op= $b; Equivalent of $a = $a op $b. op can be any of: * / % +- & | ^ << >>
String Operators/Constants
@ String catenation $c @ $d Concatenates strings $c and $d into a single string. Numeric literals/variables convert to strings.
NL New Line $c NL $d Same as catenation example with new-line between $c and $d
TAB Tab $c TAB $d Same as catenation example with tab between $c and $d.
SPC Space $c SPC $d Same as catenation example with space between space between $c and $d.
$= String equal to $c $= $d 1 if $c is equal to $d .
 !$= String not equal to $c !$= $d 1 if $c not equal to $d.
Miscellaneous Operators
 ? : Conditional x ? y : z Substitute y if x equal to 1, else substitute z.
[ ] Array element $a[5] Sixth element of array $a
. Field/Method selection  %obj.field %obj.method() Select a console method or field
() Grouping == ==
{} Blocking == ==
, Listing == ==
 :: Namespace Item::onCollision() This definition of the onCollision() function is in the Item namespace.
" " String constant (normal) "Hello world" This is a normal string
This is a tagged string. The value of a tagged string is sent only once to a client.
' ' String constant (tagged) 'Torque rocks' from the server (across the network). Subsequently, only the 'tag' is sent. All clients will store the string at and index identified by the 'tag' and can look up the value instead of requiring it be send repeatedly.
// Single line comment // This is a comment Used to comment out a single line of TS
/* */ Multi-line comment /* This is a multi line comment */ Used to comment out multiple consecutive lines. /* opens the comment and */ closes it.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.