Skip to content

Operators

Arithmetic Operators

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

Comparison Operators

OperatorDescriptionExample
==Equalitya == b
!=Inequalitya != 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

Bitwise Operators

OperatorDescriptionExample
&Bitwise ANDa & b
|Bitwise ORa | b
^Bitwise XORa ^ b
~Bitwise NOT~a
<<Left shifta << 2
>>Right shifta >> 2

Assignment Operators

OperatorDescriptionExample
:=Assignmentx := 5

Chaining Operators

OperatorDescriptionExample
.Member access / chainingstream.where(...).select(...)
?.Optional accessuser?.name
??Null coalescevalue ?? default

Collection Operators

OperatorDescriptionExample
[]Indexingarray[0]
[:]Slicearray[1:3]
inMembershipx in list
not inNon-membershipx not in list

Range Operators

OperatorDescriptionExample
..Exclusive range0..10 (0 to 9)
..=Inclusive range0..=10 (0 to 10)

Lambda Operators

OperatorDescriptionExample
=>Lambda expressionx => x * 2
->Return typefn add(a: int, b: int) -> int

Duration Operators

varpulis
# Duration suffixes
5s      # 5 seconds
10m     # 10 minutes
2h      # 2 hours
1d      # 1 day
500ms   # 500 milliseconds
100us   # 100 microseconds
50ns    # 50 nanoseconds

Operator Precedence (highest to lowest)

  1. (), [], ., ?.
  2. **
  3. - (unary), not, ~
  4. *, /, %
  5. +, -
  6. <<, >>
  7. &
  8. ^
  9. |
  10. <, <=, >, >=, ==, !=, in, not in
  11. and
  12. or
  13. ??
  14. :=

Varpulis - Next-generation streaming analytics engine