Skip to content

Operators

Operators are a core part of the Blossom language, providing the building blocks for creating expressions, manipulating data and composing functions.

Arithmetic

These operators perform standard arithmetic calculations.

OperatorDescriptionExample
+Addition5 + 3
-Subtraction10 - 4
*Multiplication6 * 7
/Division15 / 3
%Modulo (remainder)17 % 5

For more complex operations, use the Math module.

Boolean

These operators perform boolean logic and comparisons.

OperatorDescriptionExample
&Logical ANDTrue & True
|Logical ORTrue | False
!Logical NOT!False
==Equality10 == 10
!=Inequality5 != 7
>Greater than8 > 3
<Less than2 < 9
>=Greater or equal to6 >= 6
<=Less or equal to4 <= 5

Typing & Variables

These operators are used for type/variable declaration and assignment.

OperatorDescriptionExample
:Type explicitationname: String
=Value assignmentx: Int = 10
:=Type assignmentFloatList := List(Float)
:>Schema assignmentTransformation :> (Int) : Int
&>Type constraint#constraints

Collections

This section covers operators related to collections (like lists, tuples or records).

OperatorDescriptionExample
...SpreadnewList: List(Int) = [...oldList, 4, 5]

Pattern matching

These operators are used for building pattern matching flows.

Element / KeywordDescription
matchBegins a pattern matching expression.
_The wildcard pattern, matches any value. Used as the default case in match expressions.
ifUsed to add conditions to patterns.
[ head | tail]Matches the head & tail of a compatible collection type.

Pipeline

These operators are used for chaining function calls.

OperatorDescription
|>Pipeline operator. Passes the result of the left-hand expression to the right-hand function.
!>Error-handling pipeline operator. Executes the following block only if the previous pipeline step results in an error.