Skip to main content
Kira

Operators

Arithmetic Operators

OperatorDescriptionExample
+Additiona + b
-Subtractiona - b
*Multiplicationa * b
/Divisiona / b
%Moduloa % b
- (unary)Negation-a

Comparison Operators

OperatorDescriptionExample
==Equala == b
!=Not equala != b
<Less thana < b
<=Less than or equala <= b
>Greater thana > b
>=Greater than or equala >= b

Logical Operators

OperatorDescriptionExample
andLogical ANDa and b
orLogical ORa or b
notLogical NOTnot a

Kira uses keywords instead of symbols for logical operators. This is part of the "no surprises" philosophy — keywords are unambiguous.

Other Operators

OperatorDescriptionExample
+String concatenation"a" + "b"
??Null coalesceopt ?? default
?Try (error propagation)result?
.Field/method accessobj.field
[]Type argumentList[i32]

Operator Precedence (Highest to Lowest)

  1. . (field access), [] (type arguments)
  2. - (unary negation), not
  3. *, /, %
  4. +, -
  5. <, <=, >, >=
  6. ==, !=
  7. and
  8. or
  9. ??
  10. ?