This lists all ooc operators, from highest precendence to lowest precedence


Array access

The array-index operator is [], the array-modify operator’s short form is []=


arr[0] = '\n'
return arr[0]


The address-of operator is a post-fix &, the dereference operator is a post-fix @:

a := 42
aPtr := a&
aToo := aPtr@


Technically not an operator, but call is in that priority level:

a := func -> Int { 42 }

Member access

Also technically not an operator. Simply two identifiers side by side, not using dot, unlike some other programming languages:

dog name
dog race


The as operator is used to cast from one type to the other:

pi := 3.14
roughlyPi := pi as Int


Binary operators

The exponent operator is **, the multiplication operator is *, and the division operator is /.

Unary operators

Logical not is a prefixed !, binary not is a prefixed ~.


The addition operator is +, subtraction is -, modulo is %


Right shift is >>, left shift is <<


You have your regular less than <, greater than >, less than or equal <=, more than or equal >=, but also the comparison operator <=> (evaluates to -1 if less than, 0 if equal, 1 if greater than).


Equality operator is ==, inequality operator is !=

Binary and boolean operations

Binary and is &, xor is ^, or is |.

Logical and is &&, logical or is ||.


The ternary operator is ?: as in condition ? ifTrue : ifFalse.


The assignment operator is =, the following variants exist: +=, -=, *=, **=, /=, >>=, <<=, ^=, |=, &=.

The declare-assignment operator is :=. And the declare-property-assignment operator is ::=. For more details on these, see the Variables and Properties pages.

Double arrow

The double arrow operator => - it must be overloaded.

Operator overloading

Overloading an operator can be done as a function-like, using the operator keyword:

operator + (v1, v2: Vec2) -> Vec2 { v1 add(v2) }

However, if the operator is linked to a type, it’s better to declare it in the type itself, so that it’ll be usable even if the module containing the type declaration isn’t explicitly imported:

Vec2: class {
  // other stuff

  operator + (v: This) -> This { add(v) }