Operator 
Name 
Example 
Explanation 

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. 
++ 
autoincrement (postfix only) 
$a++ 
Increment $a. Note: ++$a is illegal. Note: the value of $a++ is that of the incremented variable: autoincrement is postfix in syntax, but preincrement in sematics (the variable is incremented, before the return value is calculated). This behavior is unlike that of C and C++. 
  
autodecrement (postfix only) 
$b 
Decrement $b. Note: $b is illegal. Note: the value of $a is that of the decremented variable: autodecrement is postfix in syntax, but predecrement in sematics (the variable is decremented, before the return value is calculated). This behavior is unlike that of C and C++. 
Relations (Arithmetic, Logical, and String) 
< 
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 nonzero (0 otherwise.) 
 
Logical OR 
$a  $b 
1 if either $a or $b is nonzero (0 otherwise.)

$= 
String equal to 
$c $= $d 
1 if $c equal to $d . 
!$= 
String not equal to 
$c !$= $d 
1 if $c not equal to $d. 
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. 11010b >> 3d == 00011b) 
Assignment and Assignment Operators 
= 
Assignment 
$a = $b; 
Assign value of $b to $a. Note: the value of an assignment is the value being assigned, so $a = $b = $c is legal. 
op= 
Assignment Operators 
$a op= $b; 
Equivalent to $a = $a op $b, where op can be any of: * / % +  &  ^ << >> 
String Operators 
@ 
String concatenation 
$c @ $d 
Concatenates strings $c and $d into a single string. Numeric literals/variables convert to strings. 
NL 
New Line 
$c NL $d 
Concatenates strings $c and $d into a single string separated by newline. Note: such a string can be decomposed with getRecord() 
TAB 
Tab 
$c TAB $d 
Concatenates strings $c and $d into a single string separated by tab. Note: such a string can be decomposed with getField() 
SPC 
Space 
$c SPC $d 
Concatenates strings $c and $d into a single string separated by space. Note: such a string can be decomposed with getWord() 
Miscellaneous 
? : 
Conditional 
x ? y : z 
Evaluates to y if x equal to 1, else evaluates to z. 
[] 
Array element 
$a[5] 
Synonymous with $a5. 
( ) 
Delimiting,
Grouping 
t2dGetMin(%a, %b) if ( $a == $b ) ($a+$b)*($c$d) 
Argument list for function call Used with if, for, while, switch keywordsControl associativity in expressions 
{} 
Compound statement (Block) 
if (1) {$a = 1; $b = 2;} function foo() {$a = 1;} 
Delimit multiple statements optional for if, else, for, whileRequired for switch, datablock, new, function 
, 
Listing 
t2dGetMin(%a, %b) %M[1,2] 
Delimiter for arguments Note: there is no "comma operator", as defined in C/C++; $a = 1, $b = 2; is a parse error 
:: 
Namespace 
Item::onCollision() 
This definition of the onCollision() function is in the Item namespace. 
. 
Field/Method selection 
%obj.field %obj.method() 
Select a console method or field 
// 
Singleline comment 
// This is a comment 
Used to comment out a single line of code. 
/* */ 
Multiline comment 
/*This is a a multiline comment*/

Used to comment out multiple consecutive lines. /* opens the comment, and */ closes it. 