Skip to content

Operators

Operators are symbols that describe and specify arithmetic or logical tasks.

Arithmetic Operators

Arithmetic operators are used to perform common mathematical operations. And some times it is also used for non-numeric types.

OperatorDescriptionSupported Type(s)
+Additionintegers, floats, strings
-Subtractionintegers, floats
*Multiplicationinteger, floats
/Divisioninteger, floats
%Modulusintegers
<<Left shiftinteger << integer
>>Right shiftinteger >> integer
++Equals to += 1 as suffixlvalue arithmetic++
--Equals to -= 1 as suffixlvalue arithmetic--

Comparison Operators

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

For == and != operators, the slices, maps, anonymous functions, and some binded types are not supported. If a structure uses one of these types, it will be unsupported also. In this case, to make a comparable relevant structure, use operator overloading and overload the comparison operators.

For binded types, all binded structures accepted as non-comparable. Other type aliases like binded as int or something like that, accepted as comparable.

Bitwise Operators

OperatorDescription
&Bitwise AND
|Bitwise OR
^Bitwise XOR, Bitwise NOT

Comparison Operators

OperatorDescription
&&Logical and
||Logical or
!Logical not

Precedences

Precedence (Descending)Operator(s)
5* % / << >> &
4+ - | ^
3== != < <= > >=
2&&
1||

Integer Overflow

Integer overflow is not checked in any way in Jule. This can be a significant cost in runtime and can significantly impact performance. To detect an integer overflow, Jule developers must place mechanisms such as assert in suspicious locations or implement the necessary runtime checks themselves.