Appendix B: Operators and Symbols

In this chapter, we'll explore mana's operators and symbol reference.

Appendix B: Operators and Symbols

This appendix contains a glossary of Mana's operators and symbols.

Arithmetic Operators

OperatorExampleDescription
+a + bAddition
-a - bSubtraction
*a * bMultiplication
/a / bDivision
%a % bRemainder (modulo)
**a ** bExponentiation (power)

Comparison Operators

OperatorExampleDescription
==a == bEqual to
!=a != bNot equal to
<a < bLess than
>a > bGreater than
<=a <= bLess than or equal to
>=a >= bGreater than or equal to

Logical Operators

OperatorExampleDescription
&&a && bLogical AND
||a || bLogical OR
!!aLogical NOT

Bitwise Operators

OperatorExampleDescription
&a & bBitwise AND
|a | bBitwise OR
^a ^ bBitwise XOR
~~aBitwise NOT
<<a << bLeft shift
>>a >> bRight shift

Assignment Operators

OperatorExampleEquivalent
=a = bAssign b to a
+=a += ba = a + b
-=a -= ba = a - b
*=a *= ba = a * b
/=a /= ba = a / b
%=a %= ba = a % b

Other Operators

OperatorExampleDescription
?value?Error propagation
??a ?? bNull coalescing
..1..10Exclusive range
..=1..=10Inclusive range
=>pat => exprMatch arm
->fn() -> TReturn type
::Type::methodPath separator
.obj.fieldField access
&&valueReference
**ptrDereference

Delimiters

SymbolDescription
{ }Block or struct literal
[ ]Array literal or indexing
( )Grouping or tuple
< >Generic parameters
;Statement terminator
:Type annotation
,Separator