Operators

Harbor has a minimal set of operators. Currently, only addition/concatenation and member access are supported.

Addition (+)

The + operator works on two numbers (addition) or two strings (concatenation).

// Number addition
result = 10 + 20

// String concatenation
message = "hello " + "world"

Mixing types (e.g. a string and a number) returns None internally. There is no automatic type coercion.

Assignment (=)

The equals sign assigns a value to a variable. See Variables & Types.

x = 42

Member access (.)

The dot operator accesses a field on an object. This is primarily used with the req object inside route handlers.

get "/info" {
    respond req.path
}

If the base value is not an object, or the field doesn't exist, the result is None.

What's not supported

The following operators do not exist in Harbor:

Category Operators
Arithmetic -, *, /, %
Comparison ==, !=, <, >, <=, >=
Logical &&, ||, !