Language version: 2 · Reference version: 2.7 · Date: 2026-10-25 · Compiler build: df7b3b14 · Entries: 22
- (operator)
Definition
Subtraction or unary minus. Applicable to numerical expressions.
Syntax
-= (operator)
Definition
Subtract assignment. Replaces the variable with its current value minus the right-hand expression. Applicable to int and float combinations using the same rules as -.
Syntax
:= (operator)
Definition
Reassignment operator. It is used to assign a new value to a previously declared variable.
Syntax
! (operator)
Definition
Logical NOT. Applicable to boolean expressions: !x is true when x is false, and false when x is true.
It is the symbol spelling of not, and the two are the same token to the lexer.
Syntax
!= (operator)
Definition
Not equal to. Applicable to expressions of any type. True when its two operands differ.
Syntax
? (operator)
Definition
Ternary conditional operator.
Syntax
* (operator)
Definition
Multiplication. Applicable to numerical expressions.
Syntax
*= (operator)
Definition
Multiply assignment. Replaces the variable with the product of its current value and the right-hand expression. Applicable to int and float combinations using the same rules as *.
Syntax
/ (operator)
Definition
Division. Applicable to numerical expressions.
Syntax
- The result is always a float, so
int h = 4 / 2is rejected. Usemath.floor,math.roundormath.ceilto get an int.
/= (operator)
Definition
Divide assignment. Replaces the variable with its current value divided by the right-hand expression. The result is always a float, so the variable must already be a float (or the assignment is rejected).
Syntax
&& (operator)
Definition
Logical AND. Applicable to boolean expressions.
Syntax
% (operator)
Definition
Modulo: the remainder of dividing the left operand by the right one. Applicable to numerical expressions, ints and floats.
The result is an int when both operands are ints, and a float when either is a float (so int x = 7.5 % 2 is rejected: use math.floor, math.round or math.ceil). A string operand is rejected. The result has the sign of the left operand: -7 % 3 is -1, 7 % -3 is 1 and -7.5 % 2 is -1.5.
Syntax
%= (operator)
Definition
Modulo assignment. Replaces the variable with the remainder of dividing its current value by the right-hand expression.
The result follows %: a float variable accepts an int or a float operand; an int variable accepts only an int operand, and a float operand is an error that suggests math.floor, math.round or math.ceil. A string variable is rejected.
Syntax
+ (operator)
Definition
Addition. Applicable to numerical expressions or strings. A unary plus (+x) is accepted.
Syntax
+= (operator)
Definition
Add assignment. Replaces the variable with the sum of its current value and the right-hand expression. Works on numbers and on two strings.
The left-hand side may be a dotted field on an object (for example point.x += 1) as well as a plain variable. The variable must already exist.
Syntax