GorGorv1.0

Operators

Arithmetic, comparison, logical, and bitwise operators in Gor.

Arithmetic

OperatorDescriptionExample
+Addition (numbers) or concatenation (strings)3 + 47
-Subtraction10 - 37
*Multiplication6 * 742
/Integer division10 / 33
%Modulo (remainder)10 % 31

Comparison

OperatorDescription
==Equal (works across all types)
!=Not equal
>Greater than (numbers and strings)
<Less than
>=Greater than or equal
<=Less than or equal

Logical

OperatorDescription
&&Logical AND (short-circuit)
||Logical OR (short-circuit)

Logical operators use short-circuit evaluation. && returns the left operand if falsy, otherwise the right. || returns the left operand if truthy, otherwise the right.

Bitwise

OperatorDescription
&Bitwise AND (numbers) or logical AND (booleans)
|Bitwise OR (numbers) or logical OR (booleans)

String Concatenation

The + operator concatenates two strings:

let greeting = "Hello" + ", " + "World!"
print(greeting)   # Hello, World!