Skip to main content

Operators

Arithmetic

OperatorDescriptionExample
+Addition (also string concatenation)a + b
-Subtractiona - b
*Multiplicationa * b
/Divisiona / b
%Modulo (remainder)a % b
int x = 10 % 3;   // 1
int y = 2 * 5; // 10

Note: compound assignment operators (+=, -=, *=, etc.) are not yet supported. Use i = i + 1 instead of i += 1.

Comparison

OperatorDescription
==Equal
!=Not equal
<Less than
<=Less than or equal
>Greater than
>=Greater than or equal

These work on int values and produce a bool. Enum values also support == and != between members of the same enum type.

Logical

OperatorDescription
&&Logical AND
||Logical OR
!Logical NOT (unary)
bool inRange = x > 0 && x < 100;
bool either = a || b;
bool flipped = !active;

Unary negation

int neg = -x;

String concatenation

+ concatenates strings with int or bool operands automatically:

string msg = "Count: " + 42 + ", active: " + true;