← Back to the index

6. Operators and Expressions

In this chapter

Arithmetic Operators

vv supports standard arithmetic operations on numbers:

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
/: Integer Division
% Modulo

Comparison Operators

Comparison operations evaluate to a boolean value (true or false):

Operator Description
== Equal
< Less Than
<= Less Than or Equal

Logical Operators

Logical operators work on boolean values.

Operator Description
not() Logical NOT (Function)
and Logical AND (Reserved)
or Logical OR (Reserved)

Assignment Operators

Used to assign or update values of variables:

Operator Description
= Assignment
+= Add and Assign
-= Subtract and Assign

Other Operators

Prefix Operators

Operator Description
- Negation - Inverts the sign of a number
try Try - Unwraps ok result or propagates error

Prefix and Infix Expressions

Expressions can be combined using prefix (e.g., not(true), -5, try result) and infix (e.g., 1 + 2, a == b) operators.

Syntactic Elements

Instead of traditional built-in functions, vv includes specific syntactic elements parsed directly as expressions. These look like functions but are built closely into the AST. Key elements include: